From 8504313572def10eb49e061fc8888f6967681236 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Mon, 24 Jun 2013 16:55:59 +0200 Subject: [PATCH] lasmicon: use namedtuple --- milkymist/lasmicon/__init__.py | 36 +++++++++------------------------- 1 file changed, 9 insertions(+), 27 deletions(-) diff --git a/milkymist/lasmicon/__init__.py b/milkymist/lasmicon/__init__.py index 08d647e2..f56e9160 100644 --- a/milkymist/lasmicon/__init__.py +++ b/milkymist/lasmicon/__init__.py @@ -1,3 +1,5 @@ +from collections import namedtuple + from migen.fhdl.std import * from migen.bus import dfi, lasmibus @@ -5,35 +7,15 @@ from milkymist.lasmicon.refresher import * from milkymist.lasmicon.bankmachine import * from milkymist.lasmicon.multiplexer import * -class PhySettings: - def __init__(self, dfi_d, nphases, rdphase, wrphase): - self.dfi_d = dfi_d - self.nphases = nphases - self.rdphase = rdphase - self.wrphase = wrphase +PhySettings = namedtuple("PhySettings", "dfi_d nphases rdphase wrphase") -class GeomSettings: - def __init__(self, bank_a, row_a, col_a): - self.bank_a = bank_a - self.row_a = row_a - self.col_a = col_a - self.mux_a = max(row_a, col_a) +class GeomSettings(namedtuple("_GeomSettings", "bank_a row_a col_a")): + def __init__(self, *args, **kwargs): + self.mux_a = max(self.row_a, self.col_a) -class TimingSettings: - def __init__(self, tRP, tRCD, tWR, tWTR, tREFI, tRFC, read_latency, write_latency, req_queue_size, read_time, write_time): - self.tRP = tRP - self.tRCD = tRCD - self.tWR = tWR - self.tWTR = tWTR - self.tREFI = tREFI - self.tRFC = tRFC - - self.read_latency = read_latency - self.write_latency = write_latency - - self.req_queue_size = req_queue_size - self.read_time = read_time - self.write_time = write_time +TimingSettings = namedtuple("TimingSettings", "tRP tRCD tWR tWTR tREFI tRFC" \ + " read_latency write_latency" \ + " req_queue_size read_time write_time") class LASMIcon(Module): def __init__(self, phy_settings, geom_settings, timing_settings): -- 2.30.2