From: Luke Kenneth Casson Leighton Date: Fri, 24 May 2019 08:49:48 +0000 (+0100) Subject: make a start on a branch simulator X-Git-Tag: div_pipeline~1964 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=aae37bd47145f9adf1c23641bd726323ed14117b;p=soc.git make a start on a branch simulator --- 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<