@@ -4,8 +4,41 @@ import _root_.circt.stage.ChiselStage
44
55class Core extends Module {
66 val io = IO (new Bundle {
7- val operation = Input (Operation ());
8- val immediate_a = Input (UInt (8 .W ));
9- val immediate_b = Input (UInt (8 .W ));
7+ val debug_memory_write = Input (Bool ());
8+ val debug_memory_write_address = Input (UInt (8 .W ));
9+ val debug_memory_write_data = Input (UInt (8 .W ));
10+
11+ val debug_dispatcher_thread_requesting_opcode = Input (Bool ());
12+ val debug_dispatcher_thread_program_pointer = Input (UInt (8 .W ));
13+
14+ val debug_dispatcher_opcode = Output (Operation ());
15+ val debug_dispatcher_program_pointer = Output (UInt (8 .W ));
1016 });
17+
18+ val memory = Module (new Memory ());
19+ val dispatcher = Module (new Dispatcher ());
20+
21+ memory.io.readPorts(0 ).enable := dispatcher.io.read_requested;
22+ memory.io.readPorts(0 ).address := dispatcher.io.read_program_pointer;
23+
24+ memory.io.writePorts(0 ).enable := io.debug_memory_write;
25+ memory.io.writePorts(0 ).address := io.debug_memory_write_address;
26+ memory.io.writePorts(0 ).data := io.debug_memory_write_data;
27+
28+ dispatcher.io.thread_requesting_opcode := io.debug_dispatcher_thread_requesting_opcode;
29+ dispatcher.io.thread_program_pointer := io.debug_dispatcher_thread_program_pointer;
30+
31+ val read_ready_delayed = RegNext (dispatcher.io.read_requested, false .B );
32+ dispatcher.io.read_ready := read_ready_delayed;
33+ dispatcher.io.read_opcode := Operation .safe(memory.io.readPorts(0 ).data(3 , 0 ))._1;
34+
35+ // when(true.B) {
36+ // printf(p"\t[Core]=====");
37+ // printf(p"\n\tdebug.thread_requesting_opcode=${io.debug_dispatcher_thread_requesting_opcode}");
38+ // printf(p"\n\tdispatcher.read_requested=${dispatcher.io.read_requested}");
39+ // printf(p"\n\tread_ready_delayed=${read_ready_delayed}\n\n");
40+ // }
41+
42+ io.debug_dispatcher_opcode := dispatcher.io.opcode;
43+ io.debug_dispatcher_program_pointer := dispatcher.io.program_pointer;
1144}
0 commit comments