Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 2 commits
  • 2 files changed
  • 0 comments
  • 1 contributor
4  milkymist/memtest/__init__.py
@@ -39,11 +39,11 @@ def __init__(self, *args, **kwargs):
39 39
 		self.comb += self.lfsr.ce.eq(1)
40 40
 
41 41
 	def do_simulation(self, s):
42  
-		print(s.rd(self.lfsr.o))
  42
+		print("{0:032x}".format(s.rd(self.lfsr.o)))
43 43
 
44 44
 def _sim_lfsr():
45 45
 	from migen.sim.generic import Simulator
46  
-	tb = _LFSRTB(3, 4, [3, 2])
  46
+	tb = _LFSRTB(128)
47 47
 	sim = Simulator(tb)
48 48
 	sim.run(20)
49 49
 
43  tb/lasmicon/lasmicon_df.py
... ...
@@ -0,0 +1,43 @@
  1
+from migen.fhdl.std import *
  2
+from migen.bus import lasmibus
  3
+from migen.actorlib import dma_lasmi
  4
+from migen.sim.generic import Simulator, TopLevel, Proxy
  5
+
  6
+from milkymist.lasmicon import *
  7
+
  8
+from common import sdram_phy, sdram_geom, sdram_timing, DFILogger
  9
+
  10
+class TB(Module):
  11
+	def __init__(self):
  12
+		self.submodules.ctler = LASMIcon(sdram_phy, sdram_geom, sdram_timing)
  13
+		# FIXME: remove dummy master
  14
+		self.submodules.xbar = lasmibus.Crossbar([self.ctler.lasmic], 2, self.ctler.nrowbits)
  15
+		self.submodules.logger = DFILogger(self.ctler.dfi)
  16
+		self.submodules.writer = dma_lasmi.Writer(self.xbar.masters[0])
  17
+
  18
+		self.comb += self.writer.address_data.stb.eq(1)
  19
+		pl = self.writer.address_data.payload
  20
+		pl.a.reset = 255
  21
+		pl.d.reset = pl.a.reset*2
  22
+		self.sync += If(self.writer.address_data.ack,
  23
+			pl.a.eq(pl.a + 1),
  24
+			pl.d.eq(pl.d + 2)
  25
+		)
  26
+		self.open_row = None
  27
+
  28
+	def do_simulation(self, s):
  29
+		dfip = Proxy(s, self.ctler.dfi)
  30
+		for p in dfip.phases:
  31
+			if p.ras_n and not p.cas_n and not p.we_n: # write
  32
+				d = dfip.phases[0].wrdata | (dfip.phases[1].wrdata << 64)
  33
+				print(d)
  34
+				if d != p.address//2 + p.bank*512 + self.open_row*2048:
  35
+					print("**** ERROR ****")
  36
+			elif not p.ras_n and p.cas_n and p.we_n: # activate
  37
+				self.open_row = p.address
  38
+
  39
+def main():
  40
+	sim = Simulator(TB(), TopLevel("my.vcd"))
  41
+	sim.run(3500)
  42
+
  43
+main()

No commit comments for this range

Something went wrong with that request. Please try again.