Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: c7b9dfc203
Fetching contributors…

Cannot retrieve contributors at this time

file 22 lines (20 sloc) 0.702 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
from migen.bus import wishbone
from migen.bus import csr
from migen.fhdl.structure import *
from migen.corelogic import timeline

class Inst():
def __init__(self):
self.wishbone = wishbone.Slave("to_csr")
self.csr = csr.Master("from_wishbone")
self.timeline = timeline.Inst(self.wishbone.cyc_i & self.wishbone.stb_i,
[(1, [self.csr.we_o.eq(self.wishbone.we_i)]),
(2, [self.wishbone.ack_o.eq(1)]),
(3, [self.wishbone.ack_o.eq(0)])])

def get_fragment(self):
sync = [
self.csr.we_o.eq(0),
self.csr.d_o.eq(self.wishbone.dat_i),
self.csr.a_o.eq(self.wishbone.adr_i[2:16]),
self.wishbone.dat_o.eq(self.csr.d_i)
]
return Fragment(sync=sync) + self.timeline.get_fragment()
Something went wrong with that request. Please try again.