From aae37bd47145f9adf1c23641bd726323ed14117b Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Fri, 24 May 2019 09:49:48 +0100 Subject: [PATCH] make a start on a branch simulator --- src/experiment/score6600.py | 76 +++++++++++++++++++++++++++++++++++-- 1 file changed, 73 insertions(+), 3 deletions(-) diff --git a/src/experiment/score6600.py b/src/experiment/score6600.py index 1ac6ec11..c3df9000 100644 --- a/src/experiment/score6600.py +++ b/src/experiment/score6600.py @@ -416,7 +416,7 @@ class RegSim: yield from self.dump(dut) assert False -def int_instr(dut, alusim, op, src1, src2, dest): +def int_instr(dut, op, src1, src2, dest): for i in range(len(dut.int_insn_i)): yield dut.int_insn_i[i].eq(0) yield dut.int_dest_i.eq(dest) @@ -424,7 +424,6 @@ def int_instr(dut, alusim, op, src1, src2, dest): yield dut.int_src2_i.eq(src2) yield dut.int_insn_i[op].eq(1) yield dut.reg_enable_i.eq(1) - alusim.op(op, src1, src2, dest) def print_reg(dut, rnums): @@ -436,6 +435,76 @@ def print_reg(dut, rnums): print ("reg %s: %s" % (','.join(rnums), ','.join(rs))) +def create_random_ops(n_ops): + insts = [] + for i in range(n_ops): + src1 = randint(1, dut.n_regs-1) + src2 = randint(1, dut.n_regs-1) + dest = randint(1, dut.n_regs-1) + op = randint(0, 3) + + instrs.append((src1, src2, dest, op)) + return insts + + +def scoreboard_branch_sim(dut, alusim): + + yield dut.int_store_i.eq(1) + + for i in range(2): + + # set random values in the registers + for i in range(1, dut.n_regs): + val = 31+i*3 + val = randint(0, (1<