def testWriteAndReadCommitAtEveryOperation(self): """ SFIFO: Write and Read simultaneously, Commit at every operation """ DEPTH = [2, 4, 7, 8, 9, 10] def stim(DEPTH): @instance def _inst(): data_in = itertools.cycle(xrange(128)) yield self.reset() yield self.fifo_state_check() yield self.fifo_write(data_in.next(), wcmd=self.COMMIT) yield self.fifo_state_check() for i in range(2, DEPTH + 1): for _ in range(1, i + 1): yield self.fifo_write_read(data_in.next(), wcmd=self.COMMIT, rcmd=self.COMMIT) yield self.fifo_state_check() yield self.fifo_read(data_in.next(), rcmd=self.COMMIT) yield self.fifo_state_check() yield self.clk.posedge raise StopSimulation return _inst getDut = sim.DUTer() for s in self.simulators: getDut.selectSimulator(s) for dpt in DEPTH: self.sfifo_model = sfifo_beh.sfifo_beh(dpt) dut = getDut( fifo_speculative, rst=self.rst, clk=self.clk, full=self.full, we=self.we, din=self.din, empty=self.empty, re=self.re, dout=self.dout, wr_commit=self.wr_commit, wr_discard=self.wr_discard, rd_commit=self.rd_commit, rd_discard=self.rd_discard, afull=self.afull, aempty=self.aempty, count=self.count, afull_th=None, aempty_th=None, ovf=self.ovf, udf=self.udf, count_max=self.count_max, depth=dpt, width=None, ) stm = stim(dpt) Simulation(self.clkgen, dut, stm).run() del dut, stm
def testWriteThenReadDiscardAfterTheLastOperation(self): """ SFIFO: Write then Read, Discard after the last operation """ DEPTH = [2, 4, 7, 8, 9, 10] def stim(DEPTH): @instance def _inst(): data_in = itertools.cycle(xrange(128)) yield self.reset() yield self.fifo_state_check() for i in range(1, DEPTH + 1): # Fill up to i and Discard for _ in range(1, i + 1): yield self.fifo_write(data_in.next()) yield self.fifo_state_check() self.fifo_command(wcmd=self.DISCARD) yield self.fifo_state_check() # Fill up to i and Commit for _ in range(1, i + 1): yield self.fifo_write(data_in.next()) yield self.fifo_state_check() self.fifo_command(wcmd=self.COMMIT) yield self.fifo_state_check() # Drain down to 0 and Discard for _ in range(1, i + 1): yield self.fifo_read() yield self.fifo_state_check() self.fifo_command(rcmd=self.DISCARD) yield self.fifo_state_check() # Drain down to 0 and Commit for _ in range(1, i + 1): yield self.fifo_read() yield self.fifo_state_check() self.fifo_command(rcmd=self.COMMIT) yield self.fifo_state_check() yield self.clk.posedge raise StopSimulation return _inst getDut = sim.DUTer() for s in self.simulators: getDut.selectSimulator(s) for dpt in DEPTH: self.sfifo_model = sfifo_beh.sfifo_beh(dpt) dut = getDut( fifo_speculative, rst=self.rst, clk=self.clk, full=self.full, we=self.we, din=self.din, empty=self.empty, re=self.re, dout=self.dout, wr_commit=self.wr_commit, wr_discard=self.wr_discard, rd_commit=self.rd_commit, rd_discard=self.rd_discard, afull=self.afull, aempty=self.aempty, count=self.count, afull_th=None, aempty_th=None, ovf=self.ovf, udf=self.udf, count_max=self.count_max, depth=dpt, width=None, ) stm = stim(dpt) Simulation(self.clkgen, dut, stm).run() del dut, stm