return cmd.valid & cmd.ready & getattr(cmd, attr)
for i, (phase, sel) in enumerate(zip(self.dfi.phases, self.sel)):
- nranks = len(phase.cs)
+ nranks = len(phase.cs_n)
rankbits = log2_int(nranks)
if hasattr(phase, "reset_n"):
m.d.comb += phase.reset_n.eq(1)
m.d.comb += rank_decoder.i.eq((Array(cmd.ba[-rankbits:] for cmd in self.commands)[sel]))
if i == 0: # Select all ranks on refresh.
with m.If(sel == STEER_REFRESH):
- m.d.sync += phase.cs.eq(1)
+ m.d.sync += phase.cs_n.eq(0)
with m.Else():
- m.d.sync += phase.cs.eq(rank_decoder.o)
+ m.d.sync += phase.cs_n.eq(rank_decoder.o)
else:
- m.d.sync += phase.cs.eq(rank_decoder.o)
+ m.d.sync += phase.cs_n.eq(rank_decoder.o)
m.d.sync += phase.bank.eq(Array(cmd.ba[:-rankbits] for cmd in self.commands)[sel])
else:
m.d.sync += [
- phase.cs.eq(1),
+ phase.cs_n.eq(0),
phase.bank.eq(Array(cmd.ba for cmd in self.commands)[sel]),
]
with m.If(self._command_issue.w_stb):
m.d.comb += [
- self._phase.cs.eq(Repl(value=self._command.w_data[0], count=len(self._phase.cs))),
+ self._phase.cs_n.eq(Repl(value=~self._command.w_data[0],
+ count=len(self._phase.cs_n))),
self._phase.we.eq(self._command.w_data[1]),
self._phase.cas.eq(self._command.w_data[2]),
self._phase.ras.eq(self._command.w_data[3]),
]
with m.Else():
m.d.comb += [
- self._phase.cs.eq(Repl(value=0, count=len(self._phase.cs))),
+ self._phase.cs_n.eq(Repl(value=1, count=len(self._phase.cs_n))),
self._phase.we.eq(0),
self._phase.cas.eq(0),
self._phase.ras.eq(0),
("address", addressbits, DIR_FANOUT),
("bank", bankbits, DIR_FANOUT),
("cas", 1, DIR_FANOUT),
- ("cs", nranks, DIR_FANOUT),
+ ("cs_n", nranks, DIR_FANOUT),
("ras", 1, DIR_FANOUT),
("we", 1, DIR_FANOUT),
("clk_en", nranks, DIR_FANOUT),
def elaborate(self, platform):
m = Module()
- with m.If(self.phase.cs & self.phase.ras & ~self.phase.cas):
+ with m.If(~self.phase.cs_n & self.phase.ras & ~self.phase.cas):
m.d.comb += [
self.activate.eq(~self.phase.we),
self.precharge.eq(self.phase.we),
]
- with m.If(self.phase.cs & ~self.phase.ras & self.phase.cas):
+ with m.If(~self.phase.cs_n & ~self.phase.ras & self.phase.cas):
m.d.comb += [
self.write.eq(self.phase.we),
self.read.eq(~self.phase.we),
ps = Signal().like(cnt)
m.d.comb += ps.eq((cnt + np)*int(self.timings["tCK"]))
state = Signal(4)
- m.d.comb += state.eq(Cat(phase.we, phase.cas, phase.ras, phase.cs))
+ m.d.comb += state.eq(Cat(phase.we, phase.cas, phase.ras,
+ phase.cs_n))
all_banks = Signal()
m.d.comb += all_banks.eq(