import subprocess
import struct
import random
-import pdb
-
class Register:
def __init__(self, num):
self.num = num
+
class RegRegOp:
def __init__(self):
self.ops = {
assert(rc == 0)
-
class RegImmOp:
def __init__(self):
self.ops = {
else:
assert(rc == 0)
+
class LdStOp:
def __init__(self):
self.ops = {
self.opcodestr = random.choice(list(self.ops.keys()))
self.opcode = self.ops[self.opcodestr]
self.r1 = Register(random.randrange(32))
- self.r2 = Register(random.randrange(1,32))
+ self.r2 = Register(random.randrange(1, 32))
self.imm = random.randrange(32767)
def generate_instruction(self):
assert(r2sel == self.r2.num)
imm = yield pdecode2.e.imm_data.data
- in2_sel = yield pdecode2.dec.op.in2_sel
assert(imm == self.imm)
update = yield pdecode2.e.update
yield from checker.check_results(pdecode2)
-
sim.add_process(process)
with sim.write_vcd("%s.vcd" % name, "%s.gtkw" % name,
traces=[pdecode2.ports()]):
sim.run()
+
def test_reg_reg(self):
self.run_tst(RegRegOp, "reg_reg")
def test_branch_rel(self):
self.run_tst(BranchRel, "branch_rel")
+
if __name__ == "__main__":
unittest.main()