Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

lasmicon: use namedtuple

  • Loading branch information...
commit 8504313572def10eb49e061fc8888f6967681236 1 parent e573733
Sébastien Bourdeauducq authored June 24, 2013

Showing 1 changed file with 9 additions and 27 deletions. Show diff stats Hide diff stats

  1. 36  milkymist/lasmicon/__init__.py
36  milkymist/lasmicon/__init__.py
... ...
@@ -1,3 +1,5 @@
  1
+from collections import namedtuple
  2
+
1 3
 from migen.fhdl.std import *
2 4
 from migen.bus import dfi, lasmibus
3 5
 
@@ -5,35 +7,15 @@
5 7
 from milkymist.lasmicon.bankmachine import *
6 8
 from milkymist.lasmicon.multiplexer import *
7 9
 
8  
-class PhySettings:
9  
-	def __init__(self, dfi_d, nphases, rdphase, wrphase):
10  
-		self.dfi_d = dfi_d
11  
-		self.nphases = nphases
12  
-		self.rdphase = rdphase
13  
-		self.wrphase = wrphase
  10
+PhySettings = namedtuple("PhySettings", "dfi_d nphases rdphase wrphase")
14 11
 
15  
-class GeomSettings:
16  
-	def __init__(self, bank_a, row_a, col_a):
17  
-		self.bank_a = bank_a
18  
-		self.row_a = row_a
19  
-		self.col_a = col_a
20  
-		self.mux_a = max(row_a, col_a)
  12
+class GeomSettings(namedtuple("_GeomSettings", "bank_a row_a col_a")):
  13
+	def __init__(self, *args, **kwargs):
  14
+		self.mux_a = max(self.row_a, self.col_a)
21 15
 
22  
-class TimingSettings:
23  
-	def __init__(self, tRP, tRCD, tWR, tWTR, tREFI, tRFC, read_latency, write_latency, req_queue_size, read_time, write_time):
24  
-		self.tRP = tRP
25  
-		self.tRCD = tRCD
26  
-		self.tWR = tWR
27  
-		self.tWTR = tWTR
28  
-		self.tREFI = tREFI
29  
-		self.tRFC = tRFC
30  
-		
31  
-		self.read_latency = read_latency
32  
-		self.write_latency = write_latency
33  
-		
34  
-		self.req_queue_size = req_queue_size
35  
-		self.read_time = read_time
36  
-		self.write_time = write_time
  16
+TimingSettings = namedtuple("TimingSettings", "tRP tRCD tWR tWTR tREFI tRFC" \
  17
+	" read_latency write_latency" \
  18
+	" req_queue_size read_time write_time")
37 19
 
38 20
 class LASMIcon(Module):
39 21
 	def __init__(self, phy_settings, geom_settings, timing_settings):

0 notes on commit 8504313

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