Commit 99c98087 authored by alan's avatar alan
Browse files

fixed shift insturctions

parent 18001857
......@@ -114,10 +114,10 @@ def run_cpu(imem, dmem, symbols, debug):
# Data Memory Write
dmem.clock(as_twos_comp(result), rs2_value, mem_wr, mem_val)
if instr.instr_name == "slli":
writeback_mux = make_mux(lambda : 4 + pc_val, lambda: sextend_res, lambda: rdata, lambda: 0) # replace first None with dmem.out() and 2nd None with csr
else:
writeback_mux = make_mux(lambda : 4 + pc_val, lambda: result, lambda: rdata, lambda: 0) # replace first None with dmem.out() and 2nd None with csr
# if instr.instr_name == "slli":
# writeback_mux = make_mux(lambda : 4 + pc_val, lambda: sextend_res, lambda: rdata, lambda: 0) # replace first None with dmem.out() and 2nd None with csr
# else:
writeback_mux = make_mux(lambda : 4 + pc_val, lambda: result, lambda: rdata, lambda: 0) # replace first None with dmem.out() and 2nd None with csr
my_reg.clock(int(instr.rd,2), writeback_mux(wb_sel), rf_wen)
......@@ -133,7 +133,8 @@ def run_cpu(imem, dmem, symbols, debug):
rd_value = my_reg.read(int(instr.rd, 2))
print(' rd_val: ' + str(rd_value) + ' rs1_val: ' + format(rs1_value, "x") + ' rs2_val: ' + format(rs2_value, "x") )
if pc_val in symbols:
print ("-"*10 + symbols[pc_val] + "-"*10)
if debug != 0:
print('rd: ' + str(rd_value) + ' rs1: ' + str(rs1_value) + ' rs2: ' + str(rs2_value))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment