Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

norflash: use new timeline API

  • Loading branch information...
commit e3ef12144035a269e8104d45e41eadd8a78c0b4e 1 parent 7b14e0b
Sébastien Bourdeauducq authored March 15, 2012

Showing 1 changed file with 16 additions and 13 deletions. Show diff stats Hide diff stats

  1. 29  milkymist/norflash/__init__.py
29  milkymist/norflash/__init__.py
... ...
@@ -1,28 +1,31 @@
1 1
 from migen.fhdl.structure import *
2 2
 from migen.bus import wishbone
3  
-from migen.corelogic import timeline
  3
+from migen.corelogic.misc import timeline
4 4
 
5 5
 class NorFlash:
6 6
 	def __init__(self, adr_width, rd_timing):
  7
+		self.adr_width = adr_width
  8
+		self.rd_timing = rd_timing
  9
+		
7 10
 		self.bus = wishbone.Interface()
8 11
 		self.adr = Signal(BV(adr_width-1))
9 12
 		self.d = Signal(BV(16))
10 13
 		self.oe_n = Signal()
11 14
 		self.we_n = Signal()
12 15
 		self.ce_n = Signal()
13  
-		self.timeline = timeline.Timeline(self.bus.cyc & self.bus.stb,
14  
-			[(0, [self.adr.eq(Cat(0, self.bus.adr[:adr_width-2]))]),
15  
-			(rd_timing, [
16  
-				self.bus.dat_r[16:].eq(self.d),
17  
-				self.adr.eq(Cat(1, self.bus.adr[:adr_width-2]))]),
18  
-			(2*rd_timing, [
19  
-				self.bus.dat_r[:16].eq(self.d),
20  
-				self.bus.ack.eq(1)]),
21  
-			(2*rd_timing+1, [
22  
-				self.bus.ack.eq(0)])])
23 16
 	
24 17
 	def get_fragment(self):
25 18
 		comb = [self.oe_n.eq(0), self.we_n.eq(1),
26 19
 			self.ce_n.eq(0)]
27  
-		return Fragment(comb, pads={self.adr, self.d, self.oe_n, self.we_n, self.ce_n}) \
28  
-			+ self.timeline.get_fragment()
  20
+		sync = timeline(self.bus.cyc & self.bus.stb, [
  21
+			(0, [self.adr.eq(Cat(0, self.bus.adr[:self.adr_width-2]))]),
  22
+			(self.rd_timing, [
  23
+				self.bus.dat_r[16:].eq(self.d),
  24
+				self.adr.eq(Cat(1, self.bus.adr[:self.adr_width-2]))]),
  25
+			(2*self.rd_timing, [
  26
+				self.bus.dat_r[:16].eq(self.d),
  27
+				self.bus.ack.eq(1)]),
  28
+			(2*self.rd_timing + 1, [
  29
+				self.bus.ack.eq(0)])
  30
+		])
  31
+		return Fragment(comb, sync, pads={self.adr, self.d, self.oe_n, self.we_n, self.ce_n})

0 notes on commit e3ef121

Please sign in to comment.
Something went wrong with that request. Please try again.