for i, (phase, sel) in enumerate(zip(self.dfi.phases, self.sel)):
nranks = len(phase.cs)
rankbits = log2_int(nranks)
- if hasattr(phase, "reset"):
- m.d.comb += phase.reset.eq(0)
+ if hasattr(phase, "reset_n"):
+ m.d.comb += phase.reset_n.eq(1)
m.d.comb += phase.clk_en.eq(Repl(1, nranks))
if hasattr(phase, "odt"):
# FIXME: add dynamic drive for multi-rank (will be needed for high frequencies)
for phase in self._inti.phases]
m.d.comb += [phase.odt[i].eq(self._control.w_data[2])
for phase in self._inti.phases if hasattr(phase, "odt")]
- m.d.comb += [phase.reset.eq(self._control.w_data[3])
- for phase in self._inti.phases if hasattr(phase, "reset")]
+ m.d.comb += [phase.reset_n.eq(self._control.w_data[3])
+ for phase in self._inti.phases if hasattr(phase, "reset_n")]
return m
("we", 1, DIR_FANOUT),
("clk_en", nranks, DIR_FANOUT),
("odt", nranks, DIR_FANOUT),
- ("reset", 1, DIR_FANOUT),
+ ("reset_n", 1, DIR_FANOUT),
("act", 1, DIR_FANOUT),
# wrdata description
("wrdata", databits, DIR_FANOUT),
nranks, databits),
name=name)
self.phases += [p]
- p.reset.reset = 1
def connect(self, target):
if not isinstance(target, Interface):
# requesting the resource:
# ddr_pins = platform.request("ddr3", 0, xdr={"clk":4, "odt":4, ... })
controls = ["ras", "cas", "we", "clk_en", "odt"]
- if hasattr(self.pads, "reset"):
- controls.append("reset")
+ if hasattr(self.pads, "rst"): # this gets renamed later to match dfi
+ controls.append("rst")
+ if hasattr(self.pads, "reset_n"):
+ controls.append("reset_n")
if hasattr(self.pads, "cs"):
controls.append("cs")
for name in controls:
print ("clock", name, getattr(self.pads, name))
pad = getattr(self.pads, name)
+ # sigh, convention in nmigen_boards is "rst" but in
+ # dfi.Interface it is "reset"
+ if name == 'rst':
+ name = 'reset_n'
m.d.comb += [
pad.o_clk.eq(ClockSignal("dramsync")),
pad.o_fclk.eq(ClockSignal("sync2x")),
),
Resource("ddr3", 0,
+ Subsignal("rst", Pins("fake", dir="o")), # for sim
Subsignal("clk", Pins("H3", dir="o")),
#Subsignal("clk", DiffPairs("H3", "J3", dir="o"), Attrs(IO_TYPE="SSTL135D_I")),
Subsignal("clk_en", Pins("P1", dir="o")),
features={"cti", "bte"})
ddr_pins = platform.request("ddr3", 0, dir={"dq":"-", "dqs":"-"},
- xdr={"clk":4, "a":4, "ba":4, "clk_en":4, "we_n":4, "odt":4, "ras":4, "cas":4, "we":4})
+ xdr={"rst": 4, "clk":4, "a":4, "ba":4, "clk_en":4, "we_n":4,
+ "odt":4, "ras":4, "cas":4, "we":4})
self.ddrphy = DomainRenamer("dramsync")(ECP5DDRPHY(ddr_pins))
self._decoder.add(self.ddrphy.bus, addr=ddrphy_addr)
wire [1:0] dram_dm;
wire dram_odt;
wire [1:0] dram_tdqs_n;
- reg dram_rst = 0;
+ wire dram_rst;
ddr3 #(
.check_strict_timing(0)
) ram_chip (
- .rst_n(~dram_rst),
+ .rst_n(dram_rst),
.ck(dram_ck),
.ck_n(~dram_ck),
.cke(dram_cke),
//defparam ram_chip.
top simsoctop (
+ .ddr3_0__rst__io(dram_rst),
.ddr3_0__dq__io(dram_dq),
.ddr3_0__dqs__p(dram_dqs),
.ddr3_0__clk__io(dram_ck),
begin
$dumpfile("simsoc.fst");
$dumpvars(0, clkin);
+ $dumpvars(0, dram_rst);
$dumpvars(0, dram_dq);
$dumpvars(0, dram_dqs);
$dumpvars(0, dram_ck);
reg [31:0] tmp;
initial
begin
- dram_rst = 1;
#350; // Wait for RESET and POR
- // Software control
- dram_rst = 0;
-
- #10;
-
$display("Release RESET_N");
wishbone_write(32'h0000900c >> 2, 32'h0); // p0 address
wishbone_write(32'h00009010 >> 2, 32'h0); // p0 baddress
wishbone_write(32'h00009000 >> 2, 8'h0C); // DFII_CONTROL_ODT|DFII_CONTROL_RESET_N
+
$display("Enable CKE");
wishbone_write(32'h00009000 >> 2, 8'h0E); // DFII_CONTROL_ODT|DFII_CONTROL_RESET_N|DFI_CONTROL_CKE
if (dram_cke != 1)
def process():
yield from wb_write(csrhost.bus, DFII_CONTROL_ADDR >> 2, (1 << 3), sel=0xF)
yield
- self.assertTrue((yield dut.master.phases[0].reset))
+ self.assertTrue((yield dut.master.phases[0].reset_n))
yield from wb_write(csrhost.bus, DFII_CONTROL_ADDR >> 2, 0, sel=0xF)
yield
- self.assertFalse((yield dut.master.phases[0].reset))
+ self.assertFalse((yield dut.master.phases[0].reset_n))
runSimulation(m, process, "test_dfiinjector.vcd")