From 02beab8bae87079608f624b07ff77181c66cceaf Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Sat, 11 Apr 2020 12:15:07 +0100 Subject: [PATCH] holy cow, decode and run instruction works! --- src/soc/experiment/score6600.py | 99 +++++++++++++++++++++++++++++++-- 1 file changed, 95 insertions(+), 4 deletions(-) diff --git a/src/soc/experiment/score6600.py b/src/soc/experiment/score6600.py index 7303a7e6..454d6b36 100644 --- a/src/soc/experiment/score6600.py +++ b/src/soc/experiment/score6600.py @@ -2,6 +2,7 @@ from nmigen.compat.sim import run_simulation from nmigen.cli import verilog, rtlil from nmigen.hdl.ast import unsigned from nmigen import Module, Const, Signal, Array, Cat, Elaboratable, Memory +from nmigen.back.pysim import Delay from soc.regfile.regfile import RegFileArray, treereduce from soc.scoreboard.fu_fu_matrix import FUFUDepMatrix @@ -20,6 +21,10 @@ from soc.experiment.testmem import TestMemory from soc.experiment.alu_hier import ALU, BranchALU, CompALUOpSubset from soc.decoder.power_enums import InternalOp, Function +from soc.decoder.power_decoder import (create_pdecode) +from soc.decoder.power_decoder2 import (PowerDecode2) +from soc.simulator.program import Program + from nmutil.latch import SRLatch from nmutil.nmoperator import eq @@ -843,6 +848,25 @@ class IssueToScoreboard(Elaboratable): return list(self) +def power_instr_q(dut, pdecode2, ins, code): + instrs = [pdecode2.e] + + sendlen = 1 + for idx, instr in enumerate(instrs): + yield dut.data_i[idx].eq(instr) + insn_type = yield instr.insn_type + fn_unit = yield instr.fn_unit + print("senddata ", idx, insn_type, fn_unit, instr) + yield dut.p_add_i.eq(sendlen) + yield + o_p_ready = yield dut.p_ready_o + while not o_p_ready: + yield + o_p_ready = yield dut.p_ready_o + + yield dut.p_add_i.eq(0) + + def instr_q(dut, op, funit, op_imm, imm, src1, src2, dest, branch_success, branch_fail): instrs = [{'insn_type': op, 'fn_unit': funit, 'write_reg': dest, @@ -1073,6 +1097,55 @@ def scoreboard_branch_sim(dut, alusim): yield from alusim.dump(dut) +def power_sim(m, dut, pdecode2, instruction, alusim): + + seed(0) + + for i in range(1): + + # set random values in the registers + for i in range(1, dut.n_regs): + #val = randint(0, (1<