diff options
| author | JulianCamacho <jjulian.341@gmail.com> | 2022-11-07 23:35:46 -0600 |
|---|---|---|
| committer | JulianCamacho <jjulian.341@gmail.com> | 2022-11-07 23:35:46 -0600 |
| commit | 942461c315db3269fcbe9a9ca18beee9afa78d9c (patch) | |
| tree | 5a1d3e325c5c489166569d83a3e2715a6146b284 /tb/top/decode_test.cpp | |
| parent | 6f08b7251f57778bd32f3cc2d44ddba63492cac8 (diff) | |
AƱade testbench para fetch y decode
Diffstat (limited to 'tb/top/decode_test.cpp')
| -rw-r--r-- | tb/top/decode_test.cpp | 86 |
1 files changed, 68 insertions, 18 deletions
diff --git a/tb/top/decode_test.cpp b/tb/top/decode_test.cpp index 14af035..09f973e 100644 --- a/tb/top/decode_test.cpp +++ b/tb/top/decode_test.cpp @@ -15,9 +15,68 @@ int main(int argc, char** argv) { top.trace(&trace, 0); trace.open("decode_test.vcd"); - unsigned long instructions[3] = {3766898695, - 3825578010, - 3120562179}; + // sim/control_flow.c + uint32_t rom[] = + { + 0xea000032, + 0xea000034, + 0xea000000, + 0xeafffffe, + 0xeafffffe, + 0xeafffffe, + 0xeafffffe, + 0xe3500000, + 0xda000001, + 0xe3a00001, + 0xe1a0f00e, + 0x13e00000, + 0x03a00000, + 0xe1a0f00e, + 0xe1a02000, + 0xe92d4010, + 0xe1a00002, + 0xebfffff4, + 0xe1a03000, + 0xe1a00001, + 0xebfffff1, + 0xe0933000, + 0x0a00000c, + 0xe3730001, + 0x0a00000e, + 0xe3530001, + 0x0a00000a, + 0xe1a038a1, + 0xe1a00502, + 0xe1833601, + 0xe02023c2, + 0xe0831001, + 0xe1520001, + 0xcaffffed, + 0xe0820001, + 0xe8bd8010, + 0xe1a02822, + 0xe1822801, + 0xe1a00f62, + 0xe8bd8010, + 0xe3500000, + 0xda000002, + 0xe1a02001, + 0xe2611001, + 0xeafffff2, + 0xe1e02001, + 0xe1a00002, + 0xebffffd6, + 0xe3500000, + 0xdaffffed, + 0xe1a01002, + 0xeafffff5, + 0xe59fd008, + 0xebffffd7, + 0xeafffffe, + 0xeafffffe, + 0x20000000, + }; + top.n = 0; top.z = 0; top.c = 0; @@ -26,25 +85,16 @@ int main(int argc, char** argv) { int clk_tick = 0; int time = 0; - for(int i = 0; i < sizeof(instructions); ++i) + for(int i = 0; i < sizeof(rom)/sizeof(rom[0]); ++i) { - top.insn = instructions[i]; - top.n = 0; - top.z = 0; - top.c = 0; - top.v = 0; + top.insn = rom[i]; top.eval(); trace.dump(time++); - - std::printf(" [%c%c%c%c]\n", - top.n ? 'N' : 'n', - top.z ? 'Z' : 'z', - top.c ? 'C' : 'c', - top.v ? 'V' : 'v'); - - std::printf("insn=%d, ctrl=%d", - instructions[i], top.ctrl); + + std::printf("insn=0x%08x, ctrl=0x%08x\n", + rom[i], top.ctrl); + } trace.close(); |
