summaryrefslogtreecommitdiff
path: root/sim/top.sv
diff options
context:
space:
mode:
Diffstat (limited to 'sim/top.sv')
-rw-r--r--sim/top.sv27
1 files changed, 27 insertions, 0 deletions
diff --git a/sim/top.sv b/sim/top.sv
new file mode 100644
index 0000000..6773739
--- /dev/null
+++ b/sim/top.sv
@@ -0,0 +1,27 @@
1module top
2 #( parameter UIP_BITS = 15
3 , parameter UROM_BITS = 8
4 , parameter BUS_BITS = 16
5 , parameter MEM_BITS = 8
6 )
7 ( input bit clk // verilator public
8 , input bit reset // verilator public
9 );
10
11bit [UIP_BITS-1:0] uip;
12bit [BUS_BITS-1:0] abus;
13bit [BUS_BITS-1:0] dbus;
14
15alu #("../out/alu.bin", UIP_BITS, UROM_BITS, BUS_BITS) alu(clk, reset, uip, abus, dbus);
16control #("../out/control.bin", UIP_BITS, UROM_BITS, BUS_BITS, "../out/consts.0.bin", "../out/consts.1.bin", 'h7ff8) control(clk, reset, uip, abus, dbus);
17decode #("../out/decode.bin", UIP_BITS, UROM_BITS, BUS_BITS, 12) decode(clk, reset, uip, abus, dbus);
18memory #("../out/memory.bin", UIP_BITS, UROM_BITS, BUS_BITS, "../out/image.hex", MEM_BITS) memory(clk, reset, uip, abus, dbus);
19pc #("../out/pc.bin", UIP_BITS, UROM_BITS, BUS_BITS, 0) pc(clk, reset, uip, abus, dbus);
20rf #("../out/rf.bin", UIP_BITS, UROM_BITS, BUS_BITS, 3) rf(clk, reset, uip, abus, dbus);
21tmp #("../out/tmp0.bin", UIP_BITS, UROM_BITS, BUS_BITS) tmp0(clk, reset, uip, abus, dbus);
22tmp #("../out/tmp1.bin", UIP_BITS, UROM_BITS, BUS_BITS) tmp1(clk, reset, uip, abus, dbus);
23uart #("../out/uart.bin", UIP_BITS, UROM_BITS, BUS_BITS) uart(clk, reset, uip, abus, dbus);
24
25//always @(negedge clk) $display("pc=%x uip=%x abus=%x dbus=%x tmp0=%x tmp1=%x alu=%x regs=%x:%x:%x:...:%x", pc.addr, uip, abus, dbus, tmp0.x, tmp1.x, alu.x, rf.storage[0], rf.storage[1], rf.storage[2], rf.storage[7]);
26
27endmodule