change over run_hdl_state to TestRunner class
[soc.git] / src / soc / simple / test / test_runner.py
1 """TestRunner class, runs TestIssuer instructions
2
3 related bugs:
4
5 * https://bugs.libre-soc.org/show_bug.cgi?id=363
6 * https://bugs.libre-soc.org/show_bug.cgi?id=686#c51
7 """
8 from nmigen import Module, Signal, Cat, ClockSignal
9 from nmigen.hdl.xfrm import ResetInserter
10 from copy import copy
11
12 # NOTE: to use cxxsim, export NMIGEN_SIM_MODE=cxxsim from the shell
13 # Also, check out the cxxsim nmigen branch, and latest yosys from git
14 from nmutil.sim_tmp_alternative import Simulator, Settle
15
16 from nmutil.formaltest import FHDLTestCase
17 from nmutil.gtkw import write_gtkw
18 from nmigen.cli import rtlil
19 from openpower.decoder.isa.caller import special_sprs, SVP64State
20 from openpower.decoder.isa.all import ISA
21 from openpower.endian import bigendian
22
23 from openpower.decoder.power_decoder import create_pdecode
24 from openpower.decoder.power_decoder2 import PowerDecode2
25 from soc.regfile.regfiles import StateRegs
26
27 from soc.simple.issuer import TestIssuerInternal
28
29 from soc.config.test.test_loadstore import TestMemPspec
30 from soc.simple.test.test_core import (setup_regs, check_regs, check_mem,
31 wait_for_busy_clear,
32 wait_for_busy_hi)
33 from soc.fu.compunits.test.test_compunit import (setup_tst_memory,
34 check_sim_memory)
35 from soc.debug.dmi import DBGCore, DBGCtrl, DBGStat
36 from nmutil.util import wrap
37 from soc.experiment.test.test_mmu_dcache import wb_get
38 from openpower.test.state import TestState, StateRunner
39
40
41 def setup_i_memory(imem, startaddr, instructions):
42 mem = imem
43 print("insn before, init mem", mem.depth, mem.width, mem,
44 len(instructions))
45 for i in range(mem.depth):
46 yield mem._array[i].eq(0)
47 yield Settle()
48 startaddr //= 4 # instructions are 32-bit
49 if mem.width == 32:
50 mask = ((1 << 32)-1)
51 for ins in instructions:
52 if isinstance(ins, tuple):
53 insn, code = ins
54 else:
55 insn, code = ins, ''
56 insn = insn & 0xffffffff
57 yield mem._array[startaddr].eq(insn)
58 yield Settle()
59 if insn != 0:
60 print("instr: %06x 0x%x %s" % (4*startaddr, insn, code))
61 startaddr += 1
62 startaddr = startaddr & mask
63 return
64
65 # 64 bit
66 mask = ((1 << 64)-1)
67 for ins in instructions:
68 if isinstance(ins, tuple):
69 insn, code = ins
70 else:
71 insn, code = ins, ''
72 insn = insn & 0xffffffff
73 msbs = (startaddr >> 1) & mask
74 val = yield mem._array[msbs]
75 if insn != 0:
76 print("before set", hex(4*startaddr),
77 hex(msbs), hex(val), hex(insn))
78 lsb = 1 if (startaddr & 1) else 0
79 val = (val | (insn << (lsb*32)))
80 val = val & mask
81 yield mem._array[msbs].eq(val)
82 yield Settle()
83 if insn != 0:
84 print("after set", hex(4*startaddr), hex(msbs), hex(val))
85 print("instr: %06x 0x%x %s %08x" % (4*startaddr, insn, code, val))
86 startaddr += 1
87 startaddr = startaddr & mask
88
89
90 def set_dmi(dmi, addr, data):
91 yield dmi.req_i.eq(1)
92 yield dmi.addr_i.eq(addr)
93 yield dmi.din.eq(data)
94 yield dmi.we_i.eq(1)
95 while True:
96 ack = yield dmi.ack_o
97 if ack:
98 break
99 yield
100 yield
101 yield dmi.req_i.eq(0)
102 yield dmi.addr_i.eq(0)
103 yield dmi.din.eq(0)
104 yield dmi.we_i.eq(0)
105 yield
106
107
108 def get_dmi(dmi, addr):
109 yield dmi.req_i.eq(1)
110 yield dmi.addr_i.eq(addr)
111 yield dmi.din.eq(0)
112 yield dmi.we_i.eq(0)
113 while True:
114 ack = yield dmi.ack_o
115 if ack:
116 break
117 yield
118 yield # wait one
119 data = yield dmi.dout # get data after ack valid for 1 cycle
120 yield dmi.req_i.eq(0)
121 yield dmi.addr_i.eq(0)
122 yield dmi.we_i.eq(0)
123 yield
124 return data
125
126
127 def run_hdl_state(dut, test, issuer, pc_i, svstate_i, instructions):
128 """run_hdl_state - runs a TestIssuer nmigen HDL simulation
129 """
130
131 imem = issuer.imem._get_memory()
132 core = issuer.core
133 dmi = issuer.dbg.dmi
134 pdecode2 = issuer.pdecode2
135 l0 = core.l0
136 hdl_states = []
137
138 # establish the TestIssuer context (mem, regs etc)
139
140 pc = 0 # start address
141 counter = 0 # test to pause/start
142
143 yield from setup_i_memory(imem, pc, instructions)
144 yield from setup_tst_memory(l0, test.mem)
145 yield from setup_regs(pdecode2, core, test)
146
147 # set PC and SVSTATE
148 yield pc_i.eq(pc)
149 yield issuer.pc_i.ok.eq(1)
150
151 # copy initial SVSTATE
152 initial_svstate = copy(test.svstate)
153 if isinstance(initial_svstate, int):
154 initial_svstate = SVP64State(initial_svstate)
155 yield svstate_i.eq(initial_svstate.value)
156 yield issuer.svstate_i.ok.eq(1)
157 yield
158
159 print("instructions", instructions)
160
161 # run the loop of the instructions on the current test
162 index = (yield issuer.cur_state.pc) // 4
163 while index < len(instructions):
164 ins, code = instructions[index]
165
166 print("hdl instr: 0x{:X}".format(ins & 0xffffffff))
167 print(index, code)
168
169 if counter == 0:
170 # start the core
171 yield
172 yield from set_dmi(dmi, DBGCore.CTRL,
173 1<<DBGCtrl.START)
174 yield issuer.pc_i.ok.eq(0) # no change PC after this
175 yield issuer.svstate_i.ok.eq(0) # ditto
176 yield
177 yield
178
179 counter = counter + 1
180
181 # wait until executed
182 while not (yield issuer.insn_done):
183 yield
184
185 yield Settle()
186
187 index = (yield issuer.cur_state.pc) // 4
188
189 terminated = yield issuer.dbg.terminated_o
190 print("terminated", terminated)
191
192 if index < len(instructions):
193 # Get HDL mem and state
194 state = yield from TestState("hdl", core, dut,
195 code)
196 hdl_states.append(state)
197
198 if index >= len(instructions):
199 print ("index over, send dmi stop")
200 # stop at end
201 yield from set_dmi(dmi, DBGCore.CTRL,
202 1<<DBGCtrl.STOP)
203 yield
204 yield
205
206 terminated = yield issuer.dbg.terminated_o
207 print("terminated(2)", terminated)
208 if terminated:
209 break
210
211 return hdl_states
212
213
214 class SimRunner(StateRunner):
215 def __init__(self, dut, m, pspec):
216 self.dut = dut
217
218 regreduce_en = pspec.regreduce_en == True
219 self.simdec2 = simdec2 = PowerDecode2(None, regreduce_en=regreduce_en)
220 m.submodules.simdec2 = simdec2 # pain in the neck
221
222 def prepare_for_test(self, test):
223 self.test = test
224
225 def run_test(self, instructions, gen, insncode):
226 """run_sim_state - runs an ISACaller simulation
227 """
228
229 dut, test, simdec2 = self.dut, self.test, self.simdec2
230 sim_states = []
231
232 # set up the Simulator (which must track TestIssuer exactly)
233 sim = ISA(simdec2, test.regs, test.sprs, test.cr, test.mem,
234 test.msr,
235 initial_insns=gen, respect_pc=True,
236 disassembly=insncode,
237 bigendian=bigendian,
238 initial_svstate=test.svstate)
239
240 # run the loop of the instructions on the current test
241 index = sim.pc.CIA.value//4
242 while index < len(instructions):
243 ins, code = instructions[index]
244
245 print("sim instr: 0x{:X}".format(ins & 0xffffffff))
246 print(index, code)
247
248 # set up simulated instruction (in simdec2)
249 try:
250 yield from sim.setup_one()
251 except KeyError: # instruction not in imem: stop
252 break
253 yield Settle()
254
255 # call simulated operation
256 print("sim", code)
257 yield from sim.execute_one()
258 yield Settle()
259 index = sim.pc.CIA.value//4
260
261 # get sim register and memory TestState, add to list
262 state = yield from TestState("sim", sim, dut, code)
263 sim_states.append(state)
264
265 return sim_states
266
267
268 class HDLRunner(StateRunner):
269 def __init__(self, dut, m, pspec):
270 self.dut = dut
271 #hard_reset = Signal(reset_less=True)
272 self.issuer = TestIssuerInternal(pspec)
273 # use DMI RESET command instead, this does actually work though
274 #issuer = ResetInserter({'coresync': hard_reset,
275 # 'sync': hard_reset})(issuer)
276 m.submodules.issuer = self.issuer
277 self.dmi = self.issuer.dbg.dmi
278
279 def prepare_for_test(self, test):
280 self.test = test
281
282 # set up bigendian (TODO: don't do this, use MSR)
283 yield self.issuer.core_bigendian_i.eq(bigendian)
284 yield Settle()
285
286 yield
287 yield
288 yield
289 yield
290
291 def setup_during_test(self):
292 yield from set_dmi(self.dmi, DBGCore.CTRL, 1<<DBGCtrl.STOP)
293 yield
294
295 def run_test(self, pc_i, svstate_i, instructions):
296 """run_hdl_state - runs a TestIssuer nmigen HDL simulation
297 """
298
299 imem = self.issuer.imem._get_memory()
300 core = self.issuer.core
301 dmi = self.issuer.dbg.dmi
302 pdecode2 = self.issuer.pdecode2
303 l0 = core.l0
304 hdl_states = []
305
306 # establish the TestIssuer context (mem, regs etc)
307
308 pc = 0 # start address
309 counter = 0 # test to pause/start
310
311 yield from setup_i_memory(imem, pc, instructions)
312 #yield from setup_tst_memory(l0, self.test.mem)
313 yield from setup_regs(pdecode2, core, self.test)
314
315 # set PC and SVSTATE
316 yield pc_i.eq(pc)
317 yield self.issuer.pc_i.ok.eq(1)
318
319 # copy initial SVSTATE
320 initial_svstate = copy(self.test.svstate)
321 if isinstance(initial_svstate, int):
322 initial_svstate = SVP64State(initial_svstate)
323 yield svstate_i.eq(initial_svstate.value)
324 yield self.issuer.svstate_i.ok.eq(1)
325 yield
326
327 print("instructions", instructions)
328
329 # run the loop of the instructions on the current test
330 index = (yield self.issuer.cur_state.pc) // 4
331 while index < len(instructions):
332 ins, code = instructions[index]
333
334 print("hdl instr: 0x{:X}".format(ins & 0xffffffff))
335 print(index, code)
336
337 if counter == 0:
338 # start the core
339 yield
340 yield from set_dmi(dmi, DBGCore.CTRL,
341 1<<DBGCtrl.START)
342 yield self.issuer.pc_i.ok.eq(0) # no change PC after this
343 yield self.issuer.svstate_i.ok.eq(0) # ditto
344 yield
345 yield
346
347 counter = counter + 1
348
349 # wait until executed
350 while not (yield self.issuer.insn_done):
351 yield
352
353 yield Settle()
354
355 index = (yield self.issuer.cur_state.pc) // 4
356
357 terminated = yield self.issuer.dbg.terminated_o
358 print("terminated", terminated)
359
360 if index < len(instructions):
361 # Get HDL mem and state
362 state = yield from TestState("hdl", core, self.dut,
363 code)
364 hdl_states.append(state)
365
366 if index >= len(instructions):
367 print ("index over, send dmi stop")
368 # stop at end
369 yield from set_dmi(dmi, DBGCore.CTRL,
370 1<<DBGCtrl.STOP)
371 yield
372 yield
373
374 terminated = yield self.issuer.dbg.terminated_o
375 print("terminated(2)", terminated)
376 if terminated:
377 break
378
379 return hdl_states
380
381
382 class TestRunner(FHDLTestCase):
383 def __init__(self, tst_data, microwatt_mmu=False, rom=None,
384 svp64=True, run_hdl=True, run_sim=True):
385 super().__init__("run_all")
386 self.test_data = tst_data
387 self.microwatt_mmu = microwatt_mmu
388 self.rom = rom
389 self.svp64 = svp64
390 self.run_hdl = run_hdl
391 self.run_sim = run_sim
392
393 def run_all(self):
394 m = Module()
395 comb = m.d.comb
396 if self.microwatt_mmu:
397 ldst_ifacetype = 'test_mmu_cache_wb'
398 else:
399 ldst_ifacetype = 'test_bare_wb'
400 imem_ifacetype = 'test_bare_wb'
401
402 pspec = TestMemPspec(ldst_ifacetype=ldst_ifacetype,
403 imem_ifacetype=imem_ifacetype,
404 addr_wid=48,
405 mask_wid=8,
406 imem_reg_wid=64,
407 # wb_data_width=32,
408 use_pll=False,
409 nocore=False,
410 xics=False,
411 gpio=False,
412 regreduce=True,
413 svp64=self.svp64,
414 mmu=self.microwatt_mmu,
415 reg_wid=64)
416
417 ###### SETUP PHASE #######
418 # StateRunner.setup_for_test()
419
420 if self.run_hdl:
421 hdlrun = HDLRunner(self, m, pspec)
422
423 if self.run_sim:
424 simrun = SimRunner(self, m, pspec)
425
426 # run core clock at same rate as test clock
427 intclk = ClockSignal("coresync")
428 comb += intclk.eq(ClockSignal())
429
430 # TODO these should probably move into HDLRunner's constructor
431 # and become HDLRunner.pc_i and HDLRunner.svstate_i
432 if self.run_hdl:
433
434 pc_i = Signal(32)
435 svstate_i = Signal(64)
436
437 comb += hdlrun.issuer.pc_i.data.eq(pc_i)
438 comb += hdlrun.issuer.svstate_i.data.eq(svstate_i)
439
440 # nmigen Simulation - everything runs around this, so it
441 # still has to be created.
442 sim = Simulator(m)
443 sim.add_clock(1e-6)
444
445 def process():
446
447 ###### PREPARATION PHASE AT START OF RUNNING #######
448 # StateRunner.setup_during_test()
449
450 if self.run_sim:
451 simrun.setup_during_test() # TODO, some arguments?
452
453 if self.run_hdl:
454 yield from hdlrun.setup_during_test()
455
456 # get each test, completely reset the core, and run it
457
458 for test in self.test_data:
459
460 with self.subTest(test.name):
461
462 ###### PREPARATION PHASE AT START OF TEST #######
463 # StateRunner.prepare_for_test()
464
465 if self.run_sim:
466 simrun.prepare_for_test(test)
467
468 if self.run_hdl:
469 yield from hdlrun.prepare_for_test(test)
470
471 print(test.name)
472 program = test.program
473 print("regs", test.regs)
474 print("sprs", test.sprs)
475 print("cr", test.cr)
476 print("mem", test.mem)
477 print("msr", test.msr)
478 print("assem", program.assembly)
479 gen = list(program.generate_instructions())
480 insncode = program.assembly.splitlines()
481 instructions = list(zip(gen, insncode))
482
483 ###### RUNNING OF EACH TEST #######
484 # StateRunner.step_test()
485
486 # Run two tests (TODO, move these to functions)
487 # * first the Simulator, collate a batch of results
488 # * then the HDL, likewise
489 # (actually, the other way round because running
490 # Simulator somehow modifies the test state!)
491 # * finally, compare all the results
492
493 ##########
494 # 1. HDL
495 ##########
496 if self.run_hdl:
497 hdl_states = yield from hdlrun.run_test(
498 pc_i, svstate_i,
499 instructions)
500
501 ##########
502 # 2. Simulator
503 ##########
504
505 if self.run_sim:
506 sim_states = yield from simrun.run_test(
507 instructions, gen,
508 insncode)
509
510 ###### COMPARING THE TESTS #######
511
512 ###############
513 # 3. Compare
514 ###############
515
516 if self.run_sim:
517 last_sim = copy(sim_states[-1])
518 elif self.run_hdl:
519 last_sim = copy(hdl_states[-1])
520 else:
521 last_sim = None # err what are you doing??
522
523 if self.run_hdl and self.run_sim:
524 for simstate, hdlstate in zip(sim_states, hdl_states):
525 simstate.compare(hdlstate) # register check
526 simstate.compare_mem(hdlstate) # memory check
527
528 if self.run_hdl:
529 print ("hdl_states")
530 for state in hdl_states:
531 print (state)
532
533 if self.run_sim:
534 print ("sim_states")
535 for state in sim_states:
536 print (state)
537
538 # compare against expected results
539 if test.expected is not None:
540 # have to put these in manually
541 test.expected.to_test = test.expected
542 test.expected.dut = self
543 test.expected.state_type = "expected"
544 test.expected.code = 0
545 # do actual comparison, against last item
546 last_sim.compare(test.expected)
547
548 if self.run_hdl and self.run_sim:
549 self.assertTrue(len(hdl_states) == len(sim_states),
550 "number of instructions run not the same")
551
552 ###### END OF A TEST #######
553 # StateRunner.end_test()
554
555 if self.run_sim:
556 simrun.end_test() # TODO, some arguments?
557
558 if self.run_hdl:
559 # stop at end
560 yield from set_dmi(hdlrun.dmi, DBGCore.CTRL, 1<<DBGCtrl.STOP)
561 yield
562 yield
563
564 # TODO, here is where the static (expected) results
565 # can be checked: register check (TODO, memory check)
566 # see https://bugs.libre-soc.org/show_bug.cgi?id=686#c51
567 # yield from check_regs(self, sim, core, test, code,
568 # >>>expected_data<<<)
569
570 # get CR
571 cr = yield from get_dmi(hdlrun.dmi, DBGCore.CR)
572 print("after test %s cr value %x" % (test.name, cr))
573
574 # get XER
575 xer = yield from get_dmi(hdlrun.dmi, DBGCore.XER)
576 print("after test %s XER value %x" % (test.name, xer))
577
578 # test of dmi reg get
579 for int_reg in range(32):
580 yield from set_dmi(hdlrun.dmi, DBGCore.GSPR_IDX, int_reg)
581 value = yield from get_dmi(hdlrun.dmi, DBGCore.GSPR_DATA)
582
583 print("after test %s reg %2d value %x" %
584 (test.name, int_reg, value))
585
586 # pull a reset
587 yield from set_dmi(hdlrun.dmi, DBGCore.CTRL, 1<<DBGCtrl.RESET)
588 yield
589
590 ###### END OF EVERYTHING (but none needs doing, still call fn) #######
591 # StateRunner.cleanup()
592
593 if self.run_sim:
594 simrun.cleanup() # TODO, some arguments?
595
596
597 styles = {
598 'dec': {'base': 'dec'},
599 'bin': {'base': 'bin'},
600 'closed': {'closed': True}
601 }
602
603 traces = [
604 'clk',
605 ('state machines', 'closed', [
606 'fetch_pc_i_valid', 'fetch_pc_o_ready',
607 'fetch_fsm_state',
608 'fetch_insn_o_valid', 'fetch_insn_i_ready',
609 'pred_insn_i_valid', 'pred_insn_o_ready',
610 'fetch_predicate_state',
611 'pred_mask_o_valid', 'pred_mask_i_ready',
612 'issue_fsm_state',
613 'exec_insn_i_valid', 'exec_insn_o_ready',
614 'exec_fsm_state',
615 'exec_pc_o_valid', 'exec_pc_i_ready',
616 'insn_done', 'core_stop_o', 'pc_i_ok', 'pc_changed',
617 'is_last', 'dec2.no_out_vec']),
618 {'comment': 'fetch and decode'},
619 (None, 'dec', [
620 'cia[63:0]', 'nia[63:0]', 'pc[63:0]',
621 'cur_pc[63:0]', 'core_core_cia[63:0]']),
622 'raw_insn_i[31:0]',
623 'raw_opcode_in[31:0]', 'insn_type', 'dec2.dec2_exc_happened',
624 ('svp64 decoding', 'closed', [
625 'svp64_rm[23:0]', ('dec2.extra[8:0]', 'bin'),
626 'dec2.sv_rm_dec.mode', 'dec2.sv_rm_dec.predmode',
627 'dec2.sv_rm_dec.ptype_in',
628 'dec2.sv_rm_dec.dstpred[2:0]', 'dec2.sv_rm_dec.srcpred[2:0]',
629 'dstmask[63:0]', 'srcmask[63:0]',
630 'dregread[4:0]', 'dinvert',
631 'sregread[4:0]', 'sinvert',
632 'core.int.pred__addr[4:0]', 'core.int.pred__data_o[63:0]',
633 'core.int.pred__ren']),
634 ('register augmentation', 'dec', 'closed', [
635 {'comment': 'v3.0b registers'},
636 'dec2.dec_o.RT[4:0]',
637 'dec2.dec_a.RA[4:0]',
638 'dec2.dec_b.RB[4:0]',
639 ('Rdest', [
640 'dec2.o_svdec.reg_in[4:0]',
641 ('dec2.o_svdec.spec[2:0]', 'bin'),
642 'dec2.o_svdec.reg_out[6:0]']),
643 ('Rsrc1', [
644 'dec2.in1_svdec.reg_in[4:0]',
645 ('dec2.in1_svdec.spec[2:0]', 'bin'),
646 'dec2.in1_svdec.reg_out[6:0]']),
647 ('Rsrc1', [
648 'dec2.in2_svdec.reg_in[4:0]',
649 ('dec2.in2_svdec.spec[2:0]', 'bin'),
650 'dec2.in2_svdec.reg_out[6:0]']),
651 {'comment': 'SVP64 registers'},
652 'dec2.rego[6:0]', 'dec2.reg1[6:0]', 'dec2.reg2[6:0]'
653 ]),
654 {'comment': 'svp64 context'},
655 'core_core_vl[6:0]', 'core_core_maxvl[6:0]',
656 'core_core_srcstep[6:0]', 'next_srcstep[6:0]',
657 'core_core_dststep[6:0]',
658 {'comment': 'issue and execute'},
659 'core.core_core_insn_type',
660 (None, 'dec', [
661 'core_rego[6:0]', 'core_reg1[6:0]', 'core_reg2[6:0]']),
662 'issue_i', 'busy_o',
663 {'comment': 'dmi'},
664 'dbg.dmi_req_i', 'dbg.dmi_ack_o',
665 {'comment': 'instruction memory'},
666 'imem.sram.rdport.memory(0)[63:0]',
667 {'comment': 'registers'},
668 # match with soc.regfile.regfiles.IntRegs port names
669 'core.int.rp_src1.memory(0)[63:0]',
670 'core.int.rp_src1.memory(1)[63:0]',
671 'core.int.rp_src1.memory(2)[63:0]',
672 'core.int.rp_src1.memory(3)[63:0]',
673 'core.int.rp_src1.memory(4)[63:0]',
674 'core.int.rp_src1.memory(5)[63:0]',
675 'core.int.rp_src1.memory(6)[63:0]',
676 'core.int.rp_src1.memory(7)[63:0]',
677 'core.int.rp_src1.memory(9)[63:0]',
678 'core.int.rp_src1.memory(10)[63:0]',
679 'core.int.rp_src1.memory(13)[63:0]'
680 ]
681
682 # PortInterface module path varies depending on MMU option
683 if self.microwatt_mmu:
684 pi_module = 'core.ldst0'
685 else:
686 pi_module = 'core.fus.ldst0'
687
688 traces += [('ld/st port interface', {'submodule': pi_module}, [
689 'oper_r__insn_type',
690 'ldst_port0_is_ld_i',
691 'ldst_port0_is_st_i',
692 'ldst_port0_busy_o',
693 'ldst_port0_addr_i[47:0]',
694 'ldst_port0_addr_i_ok',
695 'ldst_port0_addr_ok_o',
696 'ldst_port0_exc_happened',
697 'ldst_port0_st_data_i[63:0]',
698 'ldst_port0_st_data_i_ok',
699 'ldst_port0_ld_data_o[63:0]',
700 'ldst_port0_ld_data_o_ok',
701 'exc_o_happened',
702 'cancel'
703 ])]
704
705 if self.microwatt_mmu:
706 traces += [
707 {'comment': 'microwatt_mmu'},
708 'core.fus.mmu0.alu_mmu0.illegal',
709 'core.fus.mmu0.alu_mmu0.debug0[3:0]',
710 'core.fus.mmu0.alu_mmu0.mmu.state',
711 'core.fus.mmu0.alu_mmu0.mmu.pid[31:0]',
712 'core.fus.mmu0.alu_mmu0.mmu.prtbl[63:0]',
713 {'comment': 'wishbone_memory'},
714 'core.fus.mmu0.alu_mmu0.dcache.stb',
715 'core.fus.mmu0.alu_mmu0.dcache.cyc',
716 'core.fus.mmu0.alu_mmu0.dcache.we',
717 'core.fus.mmu0.alu_mmu0.dcache.ack',
718 'core.fus.mmu0.alu_mmu0.dcache.stall,'
719 ]
720
721 write_gtkw("issuer_simulator.gtkw",
722 "issuer_simulator.vcd",
723 traces, styles, module='top.issuer')
724
725 # add run of instructions
726 sim.add_sync_process(process)
727
728 # optionally, if a wishbone-based ROM is passed in, run that as an
729 # extra emulated process
730 if self.rom is not None:
731 dcache = core.fus.fus["mmu0"].alu.dcache
732 default_mem = self.rom
733 sim.add_sync_process(wrap(wb_get(dcache, default_mem, "DCACHE")))
734
735 with sim.write_vcd("issuer_simulator.vcd"):
736 sim.run()