class Driver(Register):
def __init__(self, writethru=True):
super().__init__(8, writethru)
+ for i in range(1): # just do one for now
+ self.read_port(f"{i}")
+ self.write_port(f"{i}")
def elaborate(self, platform):
m = super().elaborate(platform)
_wrports = self._wrports
reg = self.reg
- for i in range(1): # just do one for now
- self.read_port(f"{i}")
- self.write_port(f"{i}")
comb += _wrports[0].data_i.eq(AnyConst(8))
comb += _wrports[0].wen.eq(AnyConst(1))
comb += Assume(rst == 0)
# If there is no read, then data_o should be 0
- with m.If(_rdports[0].ren):
+ with m.If(_rdports[0].ren == 0):
comb += Assert(_rdports[0].data_o == 0)
# If there is a read request
# read ports. has write-through detection (returns data written)
for rp in self._rdports:
- with m.If(rp.ren):
+ with m.If(rp.ren == 1):
if self.writethru:
wr_detect = Signal(reset_less=False)
m.d.comb += wr_detect.eq(0)
m.d.comb += rp.data_o.eq(reg)
else:
m.d.comb += rp.data_o.eq(reg)
+ with m.Else():
+ m.d.comb += rp.data_o.eq(0)
# write ports, delayed by 1 cycle
for wp in self._wrports: