Skip to content

Commit c3caf00

Browse files
committed
Properly handle HTIF writes
1 parent 967c78f commit c3caf00

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

ariane_tb.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,18 @@ extern void write_uint64 (unsigned long long address, unsigned long long data) {
3737
htif->memif().write_uint64(address, data);
3838
}
3939

40+
extern unsigned long long get_tohost_address() {
41+
return htif->get_tohost_address();
42+
}
43+
44+
extern unsigned long long get_fromhost_address() {
45+
return htif->get_fromhost_address();
46+
}
4047
// This is a 64-bit integer to reduce wrap over issues and
4148
// allow modulus. You can also use a double, if you wish.
4249

4350
double sc_time_stamp () { // Called by $time in Verilog
44-
return htif->main_time; // converts to double, to match
51+
return htif->main_time; // converts to double, to match
4552
// what SystemC does
4653
}
4754

@@ -52,6 +59,9 @@ int main(int argc, char **argv) {
5259
htif.reset(new simmem_t(argc, argv, 0x80000000, 8, 2097152));
5360

5461
htif->start();
62+
63+
// printf("fromhost: %llx, tohost: %llx\n", htif->get_fromhost_address(), htif->get_tohost_address());
64+
5565
htif->run();
5666

5767
exit(0);

simmem.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,14 @@ void simmem_t::main()
6767
}
6868
}
6969

70+
addr_t simmem_t::get_tohost_address() {
71+
return htif_t::tohost_addr;
72+
}
73+
74+
addr_t simmem_t::get_fromhost_address() {
75+
return htif_t::fromhost_addr;
76+
}
77+
7078
void simmem_t::idle()
7179
{
7280
target.switch_to();

simmem.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ class simmem_t : public htif_t
3838
public:
3939
simmem_t(int argc, char** argv, size_t b, size_t w, size_t d);
4040
int run();
41+
addr_t get_tohost_address();
42+
addr_t get_fromhost_address();
43+
4144
vluint64_t main_time; // Current simulation time
4245
private:
4346
size_t base;

0 commit comments

Comments
 (0)