import unittest
from nmigen import Module
from nmigen.sim import Simulator
+from nmutil.gtkw import write_gtkw
from openpower.consts import MSR
from openpower.decoder.power_enums import MicrOp, LDSTMode
m = Module()
pi = PortInterface(name="pi")
regspec = LDSTPipeSpec.regspec
- dut = LDSTCompUnit(pi, regspec)
+ dut = LDSTCompUnit(pi, regspec, name="ldst")
m.submodules.dut = dut
sim = Simulator(m)
sim.add_clock(1e-6)
op = OpSim(dut)
+ self.write_gtkw()
def process():
yield from op.issue(MicrOp.OP_STORE)
with sim_writer:
sim.run()
+ @classmethod
+ def write_gtkw(cls):
+ traces = [
+ 'clk',
+ ('operation', [
+ ('oper_i_ldst__insn_type', {'display': 'insn_type'}),
+ ('oper_i_ldst__ldst_mode', {'display': 'ldst_mode'}),
+ ('oper_i_ldst__zero_a', {'display': 'zero_a'}),
+ ('oper_i_ldst__imm_data__ok', {'display': 'imm_data_ok'}),
+ ('oper_i_ldst__imm_data__data[63:0]',
+ {'display': 'imm_data_data', 'base': 'dec'})
+ ]),
+ ('cu_issue_i', {'display': 'issue_i'}),
+ ('cu_busy_o', {'display': 'busy_o'})
+ ]
+ write_gtkw("test_ldst_compunit.gtkw",
+ "test_ldst_compunit.vcd",
+ traces, module="top.dut")
+
if __name__ == '__main__':
unittest.main()