aboutsummaryrefslogtreecommitdiff
path: root/fesvr/htif_hexwriter.h
diff options
context:
space:
mode:
authorAndrew Waterman <andrew@sifive.com>2019-03-31 00:49:57 -0700
committerAndrew Waterman <andrew@sifive.com>2019-03-31 00:50:15 -0700
commitf49618ca9d674ec7e596118f85027c4b503862ac (patch)
tree3b6ad73cbe8760309f930b743950a2853ad17668 /fesvr/htif_hexwriter.h
parent61cb96df00067ba61cf3816c74c18aef5677197a (diff)
downloadspike-static-link.zip
spike-static-link.tar.gz
spike-static-link.tar.bz2
Add fesvr; only globally install fesvr headers/libsstatic-link
Diffstat (limited to 'fesvr/htif_hexwriter.h')
-rw-r--r--fesvr/htif_hexwriter.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/fesvr/htif_hexwriter.h b/fesvr/htif_hexwriter.h
new file mode 100644
index 0000000..7256166
--- /dev/null
+++ b/fesvr/htif_hexwriter.h
@@ -0,0 +1,32 @@
+// See LICENSE for license details.
+
+#ifndef __HTIF_HEXWRITER_H
+#define __HTIF_HEXWRITER_H
+
+#include <map>
+#include <vector>
+#include <stdlib.h>
+#include "memif.h"
+
+class htif_hexwriter_t : public chunked_memif_t
+{
+public:
+ htif_hexwriter_t(size_t b, size_t w, size_t d);
+
+protected:
+ size_t base;
+ size_t width;
+ size_t depth;
+ std::map<addr_t,std::vector<char> > mem;
+
+ void read_chunk(addr_t taddr, size_t len, void* dst);
+ void write_chunk(addr_t taddr, size_t len, const void* src);
+ void clear_chunk(addr_t taddr, size_t len) {}
+
+ size_t chunk_max_size() { return width; }
+ size_t chunk_align() { return width; }
+
+ friend std::ostream& operator<< (std::ostream&, const htif_hexwriter_t&);
+};
+
+#endif // __HTIF_HEXWRITER_H