Skip to content

Commit

Permalink
Use RenameClockDomains decorator instead of add_submodule
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastien Bourdeauducq committed Jul 26, 2013
1 parent 8e04de5 commit bf32559
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
5 changes: 3 additions & 2 deletions milkymist/dvisampler/analysis.py
Expand Up @@ -137,8 +137,9 @@ def __init__(self):
vsync_r.eq(self.vsync)
]

fifo = AsyncFIFO(layout_len(frame_layout), 512)
self.add_submodule(fifo, {"write": "pix", "read": "sys"})
fifo = RenameClockDomains(AsyncFIFO(layout_len(frame_layout), 512),
{"write": "pix", "read": "sys"})
self.submodules += fifo
self.comb += [
fifo.we.eq(fifo_stb),
fifo.din.eq(fifo_in.raw_bits()),
Expand Down
4 changes: 2 additions & 2 deletions milkymist/dvisampler/chansync.py
Expand Up @@ -56,8 +56,8 @@ def __init__(self, nchan=3, depth=8):

###

syncbuffer = _SyncBuffer(layout_len(channel_layout), depth)
self.add_submodule(syncbuffer, "pix")
syncbuffer = RenameClockDomains(_SyncBuffer(layout_len(channel_layout), depth), "pix")
self.submodules += syncbuffer
self.comb += [
syncbuffer.din.eq(data_in.raw_bits()),
data_out.raw_bits().eq(syncbuffer.dout)
Expand Down
5 changes: 3 additions & 2 deletions milkymist/dvisampler/debug.py
Expand Up @@ -25,8 +25,9 @@ def __init__(self, pads, asmiport):
self.data0_cap.serdesstrobe.eq(self.clocking.serdesstrobe)
]

fifo = AsyncFIFO(10, 256)
self.add_submodule(fifo, {"write": "pix", "read": "sys"})
fifo = RenameClockDomains(AsyncFIFO(10, 256),
{"write": "pix", "read": "sys"})
self.submodules += fifo
self.comb += [
fifo.din.eq(self.data0_cap.d),
fifo.we.eq(1)
Expand Down
5 changes: 3 additions & 2 deletions milkymist/framebuffer/lib.py
Expand Up @@ -128,8 +128,9 @@ def __init__(self):
###

data_width = 2+2*3*bpc_dac
fifo = AsyncFIFO(data_width, 512)
self.add_submodule(fifo, {"write": "sys", "read": "vga"})
fifo = RenameClockDomains(AsyncFIFO(data_width, 512),
{"write": "sys", "read": "vga"})
self.submodules += fifo
fifo_in = self.dac.payload
fifo_out = Record(dac_layout)
self.comb += [
Expand Down
3 changes: 1 addition & 2 deletions tb/dvisampler/chansync.py
Expand Up @@ -7,8 +7,7 @@ class TB(Module):
def __init__(self, test_seq_it):
self.test_seq_it = test_seq_it

self.chansync = ChanSync()
self.add_submodule(self.chansync, {"pix": "sys"})
self.submodules.chansync = RenameClockDomains(ChanSync(), {"pix": "sys"})
self.comb += self.chansync.valid_i.eq(1)

def do_simulation(self, s):
Expand Down

0 comments on commit bf32559

Please sign in to comment.