test: also test reads on downconverter/upconverter
This commit is contained in:
parent
32a6e25021
commit
3fe3a843e0
|
@ -14,8 +14,8 @@ class DRAMMemory:
|
||||||
def read_generator(self, dram_port):
|
def read_generator(self, dram_port):
|
||||||
address = 0
|
address = 0
|
||||||
pending = 0
|
pending = 0
|
||||||
|
yield dram_port.cmd.ready.eq(0)
|
||||||
while True:
|
while True:
|
||||||
yield dram_port.cmd.ready.eq(0)
|
|
||||||
yield dram_port.rdata.valid.eq(0)
|
yield dram_port.rdata.valid.eq(0)
|
||||||
if pending:
|
if pending:
|
||||||
yield dram_port.rdata.valid.eq(1)
|
yield dram_port.rdata.valid.eq(1)
|
||||||
|
@ -27,16 +27,18 @@ class DRAMMemory:
|
||||||
elif (yield dram_port.cmd.valid):
|
elif (yield dram_port.cmd.valid):
|
||||||
pending = not (yield dram_port.cmd.we)
|
pending = not (yield dram_port.cmd.we)
|
||||||
address = (yield dram_port.cmd.adr)
|
address = (yield dram_port.cmd.adr)
|
||||||
yield
|
if pending:
|
||||||
yield dram_port.cmd.ready.eq(1)
|
yield dram_port.cmd.ready.eq(1)
|
||||||
|
yield
|
||||||
|
yield dram_port.cmd.ready.eq(0)
|
||||||
yield
|
yield
|
||||||
|
|
||||||
@passive
|
@passive
|
||||||
def write_generator(self, dram_port):
|
def write_generator(self, dram_port):
|
||||||
address = 0
|
address = 0
|
||||||
pending = 0
|
pending = 0
|
||||||
|
yield dram_port.cmd.ready.eq(0)
|
||||||
while True:
|
while True:
|
||||||
yield dram_port.cmd.ready.eq(0)
|
|
||||||
yield dram_port.wdata.ready.eq(0)
|
yield dram_port.wdata.ready.eq(0)
|
||||||
if pending:
|
if pending:
|
||||||
yield dram_port.wdata.ready.eq(1)
|
yield dram_port.wdata.ready.eq(1)
|
||||||
|
@ -49,7 +51,8 @@ class DRAMMemory:
|
||||||
elif (yield dram_port.cmd.valid):
|
elif (yield dram_port.cmd.valid):
|
||||||
pending = (yield dram_port.cmd.we)
|
pending = (yield dram_port.cmd.we)
|
||||||
address = (yield dram_port.cmd.adr)
|
address = (yield dram_port.cmd.adr)
|
||||||
yield dram_port.cmd.ready.eq(1)
|
if pending:
|
||||||
yield
|
yield dram_port.cmd.ready.eq(1)
|
||||||
yield dram_port.cmd.ready.eq(0)
|
yield
|
||||||
|
yield dram_port.cmd.ready.eq(0)
|
||||||
yield
|
yield
|
||||||
|
|
|
@ -30,12 +30,24 @@ def main_generator(dut):
|
||||||
while (yield dut.user_port.wdata.ready) == 0:
|
while (yield dut.user_port.wdata.ready) == 0:
|
||||||
yield
|
yield
|
||||||
yield
|
yield
|
||||||
|
# read
|
||||||
|
yield dut.user_port.rdata.ready.eq(1)
|
||||||
|
for i in range(8):
|
||||||
|
yield dut.user_port.cmd.valid.eq(1)
|
||||||
|
yield dut.user_port.cmd.we.eq(0)
|
||||||
|
yield dut.user_port.cmd.adr.eq(i)
|
||||||
|
yield
|
||||||
|
while (yield dut.user_port.cmd.ready) == 0:
|
||||||
|
yield
|
||||||
|
yield dut.user_port.cmd.valid.eq(0)
|
||||||
|
yield
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
tb = TB()
|
tb = TB()
|
||||||
generators = {
|
generators = {
|
||||||
"sys" : [main_generator(tb),
|
"sys" : [main_generator(tb),
|
||||||
tb.memory.write_generator(tb.internal_port)]
|
tb.memory.write_generator(tb.internal_port),
|
||||||
|
tb.memory.read_generator(tb.internal_port)]
|
||||||
}
|
}
|
||||||
clocks = {"sys": 10}
|
clocks = {"sys": 10}
|
||||||
run_simulation(tb, generators, clocks, vcd_name="sim.vcd")
|
run_simulation(tb, generators, clocks, vcd_name="sim.vcd")
|
||||||
|
|
|
@ -37,12 +37,25 @@ def main_generator(dut):
|
||||||
yield
|
yield
|
||||||
yield dut.user_port.wdata.valid.eq(0)
|
yield dut.user_port.wdata.valid.eq(0)
|
||||||
yield
|
yield
|
||||||
|
# read
|
||||||
|
for i in range(8):
|
||||||
|
yield dut.user_port.rdata.ready.eq(1)
|
||||||
|
for j in range(2):
|
||||||
|
yield dut.user_port.cmd.valid.eq(1)
|
||||||
|
yield dut.user_port.cmd.we.eq(0)
|
||||||
|
yield dut.user_port.cmd.adr.eq(i)
|
||||||
|
yield
|
||||||
|
while (yield dut.user_port.cmd.ready) == 0:
|
||||||
|
yield
|
||||||
|
yield dut.user_port.cmd.valid.eq(0)
|
||||||
|
yield
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
tb = TB()
|
tb = TB()
|
||||||
generators = {
|
generators = {
|
||||||
"sys" : [main_generator(tb),
|
"sys" : [main_generator(tb),
|
||||||
tb.memory.write_generator(tb.internal_port)]
|
tb.memory.write_generator(tb.internal_port),
|
||||||
|
tb.memory.read_generator(tb.internal_port)]
|
||||||
}
|
}
|
||||||
clocks = {"sys": 10}
|
clocks = {"sys": 10}
|
||||||
run_simulation(tb, generators, clocks, vcd_name="sim.vcd")
|
run_simulation(tb, generators, clocks, vcd_name="sim.vcd")
|
||||||
|
|
Loading…
Reference in New Issue