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 regfile.regfile import RegFileArray, treereduce
self.ls_imm_i = Signal(rwid, reset_less=True)
# inputs
- self.int_dest_i = Signal(max=n_regs, reset_less=True) # Dest R# in
- self.int_src1_i = Signal(max=n_regs, reset_less=True) # oper1 R# in
- self.int_src2_i = Signal(max=n_regs, reset_less=True) # oper2 R# in
+ self.int_dest_i = Signal(range(n_regs), reset_less=True) # Dest R# in
+ self.int_src1_i = Signal(range(n_regs), reset_less=True) # oper1 R# in
+ self.int_src2_i = Signal(range(n_regs), reset_less=True) # oper2 R# in
self.reg_enable_i = Signal(reset_less=True) # enable reg decode
# outputs
self.opw = opwid
self.n_regs = n_regs
- mqbits = (int(log(qlen) / log(2))+2, False)
+ mqbits = unsigned(int(log(qlen) / log(2))+2)
self.p_add_i = Signal(mqbits) # instructions to add (from data_i)
self.p_ready_o = Signal() # instructions were added
self.data_i = Instruction.nq(n_in, "data_i", rwid, opwid)
sync = m.d.sync
m.submodules.l = l = SRLatch(llen=self.n_adr, sync=False)
- addrs_r = Array(Signal(self.bitwid, "a_r") for i in range(self.n_adr))
+ addrs_r = Array(Signal(self.bitwid, name="a_r") \
+ for i in range(self.n_adr))
# latch set/reset
comb += l.s.eq(self.addr_en_i)
# inputs
self.enable_i = Signal(reset_less=True) # enable decoders
- self.dest_i = Signal(max=wid, reset_less=True) # Dest R# in
- self.src1_i = Signal(max=wid, reset_less=True) # oper1 R# in
- self.src2_i = Signal(max=wid, reset_less=True) # oper2 R# in
+ self.dest_i = Signal(range(wid), reset_less=True) # Dest R# in
+ self.src1_i = Signal(range(wid), reset_less=True) # oper1 R# in
+ self.src2_i = Signal(range(wid), reset_less=True) # oper2 R# in
# outputs
self.dest_o = Signal(wid, reset_less=True) # Dest unary out