X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fexperiment%2Fscore6600.py;h=456bb3ebfa07378682b2a1f4422deeb6b26d4117;hb=5d9f1eab12603ad0f9ce654b114cde087c199ac0;hp=879769a7605afbf9aafb7049593e73baa5efd301;hpb=3234d0fd9314d2761e8c2ba66da2da4bfe56c7b2;p=soc.git diff --git a/src/experiment/score6600.py b/src/experiment/score6600.py index 879769a7..456bb3eb 100644 --- a/src/experiment/score6600.py +++ b/src/experiment/score6600.py @@ -7,31 +7,101 @@ from scoreboard.fu_fu_matrix import FUFUDepMatrix from scoreboard.fu_reg_matrix import FURegDepMatrix from scoreboard.global_pending import GlobalPending from scoreboard.group_picker import GroupPicker -from scoreboard.issue_unit import IntFPIssueUnit, RegDecode +from scoreboard.issue_unit import IssueUnitGroup, IssueUnitArray, RegDecode from scoreboard.shadow import ShadowMatrix, BranchSpeculationRecord +from scoreboard.instruction_q import Instruction, InstructionQ from compalu import ComputationUnitNoDelay from alu_hier import ALU, BranchALU from nmutil.latch import SRLatch +from nmutil.nmoperator import eq -from random import randint +from random import randint, seed +from copy import deepcopy +from math import log -class CompUnits(Elaboratable): +class Memory(Elaboratable): + def __init__(self, regwid, addrw): + self.ddepth = regwid/8 + depth = (1<>self.ddepth] + + def st(self, addr, data): + self.mem[addr>>self.ddepth] = data & ((1<= 4 if is_branch: branch_ok, branch_fail = dest - dest = None + dest = src2 # ok zip up the branch success / fail instructions and # drop them into the queue, one marked "to have branch success" # the other to be marked shadow branch "fail". # one out of each of these will be cancelled for ok, fl in zip(branch_ok, branch_fail): - instrs.append((ok[0], ok[1], ok[2], ok[3], (1, 0))) - instrs.append((fl[0], fl[1], fl[2], fl[3], (0, 1))) - print ("instr %d: (%d, %d, %d, %d)" % (i, src1, src2, dest, op)) + if ok: + instrs.append((ok[0], ok[1], ok[2], ok[3], (1, 0))) + if fl: + instrs.append((fl[0], fl[1], fl[2], fl[3], (0, 1))) + print ("instr %d: (%d, %d, %d, %d, (%d, %d))" % \ + (i, src1, src2, dest, op, shadow_on, shadow_off)) yield from int_instr(dut, op, src1, src2, dest, - shadow_on, shadow_off) - yield - yield from wait_for_issue(dut) - branch_direction = dut.branch_direction_o # which way branch went + shadow_on, shadow_off) # wait for all instructions to stop before checking yield yield from wait_for_busy_clear(dut) - for (src1, src2, dest, op, (shadow_on, shadow_off)) in insts: + i = -1 + while siminsts: + instr = siminsts.pop(0) + if instr is None: + continue + (src1, src2, dest, op, (shadow_on, shadow_off)) = instr + i += 1 is_branch = op >= 4 if is_branch: branch_ok, branch_fail = dest - dest = None + dest = src2 + print ("sim %d: (%d, %d, %d, %d, (%d, %d))" % \ + (i, src1, src2, dest, op, shadow_on, shadow_off)) branch_res = alusim.op(op, src1, src2, dest) if is_branch: if branch_res: - insts.append(branch_ok) + siminsts += branch_ok else: - insts.append(branch_fail) + siminsts += branch_fail # check status yield from alusim.check(dut) @@ -629,25 +975,42 @@ def scoreboard_branch_sim(dut, alusim): def scoreboard_sim(dut, alusim): - yield dut.int_store_i.eq(1) + seed(0) - for i in range(20): + for i in range(50): # set random values in the registers for i in range(1, dut.n_regs): - val = 31+i*3 val = randint(0, (1<