Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
  • 3 commits
  • 3 files changed
  • 0 commit comments
  • 1 contributor
View
30 milkymist/asmicon/bankmachine.py
@@ -199,21 +199,23 @@ def get_fragment(self):
slicer = _AddressSlicer(self.geom_settings, self.address_align)
if self.full_selector:
selector = _FullSelector(slicer, self.bankn, self.slots)
+ buf = _Buffer(selector)
+ cmdsource = buf
else:
selector = _SimpleSelector(slicer, self.bankn, self.slots)
- buf = _Buffer(selector)
+ cmdsource = selector
# Row tracking
has_openrow = Signal()
openrow = Signal(BV(self.geom_settings.row_a))
hit = Signal()
- comb.append(hit.eq(openrow == slicer.row(buf.adr)))
+ comb.append(hit.eq(openrow == slicer.row(cmdsource.adr)))
track_open = Signal()
track_close = Signal()
sync += [
If(track_open,
has_openrow.eq(1),
- openrow.eq(slicer.row(buf.adr))
+ openrow.eq(slicer.row(cmdsource.adr))
),
If(track_close,
has_openrow.eq(0)
@@ -225,13 +227,13 @@ def get_fragment(self):
comb += [
self.cmd.ba.eq(self.bankn),
If(s_row_adr,
- self.cmd.a.eq(slicer.row(buf.adr))
+ self.cmd.a.eq(slicer.row(cmdsource.adr))
).Else(
- self.cmd.a.eq(slicer.col(buf.adr))
+ self.cmd.a.eq(slicer.col(cmdsource.adr))
)
]
- comb.append(self.cmd.tag.eq(buf.tag))
+ comb.append(self.cmd.tag.eq(cmdsource.tag))
# Control and command generation FSM
fsm = FSM("REGULAR", "PRECHARGE", "ACTIVATE", "REFRESH", delayed_enters=[
@@ -241,15 +243,15 @@ def get_fragment(self):
fsm.act(fsm.REGULAR,
If(self.refresh_req,
fsm.next_state(fsm.REFRESH)
- ).Elif(buf.stb,
+ ).Elif(cmdsource.stb,
If(has_openrow,
If(hit,
self.cmd.stb.eq(1),
- buf.ack.eq(self.cmd.ack),
- self.cmd.is_read.eq(~buf.we),
- self.cmd.is_write.eq(buf.we),
+ cmdsource.ack.eq(self.cmd.ack),
+ self.cmd.is_read.eq(~cmdsource.we),
+ self.cmd.is_write.eq(cmdsource.we),
self.cmd.cas_n.eq(0),
- self.cmd.we_n.eq(~buf.we)
+ self.cmd.we_n.eq(~cmdsource.we)
).Else(
fsm.next_state(fsm.PRECHARGE)
)
@@ -281,7 +283,11 @@ def get_fragment(self):
If(~self.refresh_req, fsm.next_state(fsm.REGULAR))
)
+ if self.full_selector:
+ buf_fragment = buf.get_fragment()
+ else:
+ buf_fragment = Fragment()
return Fragment(comb, sync) + \
selector.get_fragment() + \
- buf.get_fragment() + \
+ buf_fragment + \
fsm.get_fragment()
View
20 tb/asmicon/asmicon.py
@@ -7,25 +7,33 @@
from common import sdram_phy, sdram_geom, sdram_timing, DFILogger
-def my_generator():
- for x in range(100):
+def my_generator_r():
+ for x in range(50):
t = TRead(x)
yield t
+ print("reads done")
+
+def my_generator_w():
+ for x in range(50):
+ t = TWrite(x, x)
+ yield t
+ print("writes done")
def main():
dut = ASMIcon(sdram_phy, sdram_geom, sdram_timing)
- initiator = Initiator(dut.hub.get_port(), my_generator())
+ initiator1 = Initiator(dut.hub.get_port(), my_generator_r())
+ initiator2 = Initiator(dut.hub.get_port(), my_generator_w())
dut.finalize()
logger = DFILogger(dut.dfi)
def end_simulation(s):
- s.interrupt = initiator.done
+ s.interrupt = initiator1.done and initiator2.done
- fragment = dut.get_fragment() + initiator.get_fragment() + \
+ fragment = dut.get_fragment() + initiator1.get_fragment() + initiator2.get_fragment() + \
logger.get_fragment() + \
Fragment(sim=[end_simulation])
sim = Simulator(fragment, Runner(), TopLevel("my.vcd"))
- sim.run()
+ sim.run(700)
main()
View
14 tb/asmicon/selector.py
@@ -5,7 +5,7 @@
from migen.sim.generic import Simulator, TopLevel
from migen.sim.icarus import Runner
-from milkymist.asmicon.bankmachine import _AddressSlicer, _Selector, _Buffer
+from milkymist.asmicon.bankmachine import _AddressSlicer, _SimpleSelector
from common import SlotsLogger, sdram_geom
@@ -18,25 +18,23 @@ def my_generator(dt, offset):
class Selector:
def __init__(self, slicer, bankn, slots):
- self.selector = _Selector(slicer, bankn, slots)
- self.buf = _Buffer(self.selector)
+ self.selector = _SimpleSelector(slicer, bankn, slots)
self.queue = []
self.prng = Random(876)
def do_simulation(self, s):
if self.prng.randrange(0, 5):
- s.wr(self.buf.ack, 1)
+ s.wr(self.selector.ack, 1)
else:
- s.wr(self.buf.ack, 0)
- if s.rd(self.buf.stb) and s.rd(self.buf.ack):
- tag = s.rd(self.buf.tag)
+ s.wr(self.selector.ack, 0)
+ if s.rd(self.selector.stb) and s.rd(self.selector.ack):
+ tag = s.rd(self.selector.tag)
self.queue.append(tag)
print("==> SELECTED: " + str(tag))
print("")
def get_fragment(self):
return self.selector.get_fragment() + \
- self.buf.get_fragment() + \
Fragment(sim=[self.do_simulation])
class Completer:

No commit comments for this range

Something went wrong with that request. Please try again.