Restructure rtio.cri to follow nMigen convention

pull/1/head
Donald Sebastian Leung 2020-10-27 12:14:47 +08:00
parent 05f37c0c13
commit 32641851b7
2 changed files with 12 additions and 7 deletions

View File

@ -31,8 +31,8 @@ $ python -m rtio.test.sed.output_network
- - [ ] `rtio.rtlink`
- - [x] `rtio.sed.output_network` - Sorting network (high priority)
- - [ ] `rtio.sed.output_driver`
- [ ] Restructure to code to follow nMigen convention and re-validate existing assertions
- - [ ] `rtio.cri` (`Interface` and `CRIDecoder` only)
- [ ] Restructure to code to follow nMigen convention and re-validate existing assertions (if any)
- - [x] `rtio.cri` (`Interface` and `CRIDecoder` only)
- - [ ] `rtio.rtlink`
- - [x] `rtio.sed.output_network`
- - [ ] `rtio.sed.output_driver`

View File

@ -59,16 +59,22 @@ class Interface(Record):
class CRIDecoder(Elaboratable):
def __init__(self, slaves=2, master=None, mode="async", enable_routing=False):
m = Module()
self.m = m
if isinstance(slaves, int):
slaves = [Interface() for _ in range(slaves)]
if master is None:
master = Interface()
self.slaves = slaves
self.master = master
self.mode = mode
self.enable_routing = enable_routing
# # #
def elaborate(self, platform):
m = Module()
slaves = self.slaves
master = self.master
mode = self.mode
enable_routing = self.enable_routing
# routing
if enable_routing:
@ -114,8 +120,7 @@ class CRIDecoder(Elaboratable):
if direction == DIR_FANIN:
m.d.comb += getattr(master, name).eq(getattr(slave, name))
def elaborate(self, platform):
return self.m
return m
# Skip CRISwitch for now (depends on AutoCSR)