From d6009f1cfc587dd0e648cff12dfb62cf2d90a8ad Mon Sep 17 00:00:00 2001 From: Kia <kia@special-circumstanc.es> Date: Wed, 3 Mar 2021 19:38:45 -0700 Subject: [PATCH] work on integrating internal buses --- gearbox.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/gearbox.py b/gearbox.py index 41f4928..cebcfe3 100755 --- a/gearbox.py +++ b/gearbox.py @@ -44,8 +44,8 @@ class GearboxFCLayout(Layout): def __init__(self, *, len_storage): super().__init__([ # DATA - ("read_ptr", unsigned(range(len_storage))), # FROM GEARBOX - ("write_ptr", unsigned(range(len_storage))), # FROM GEARBOX + ("read_ptr", unsigned(len(range(len_storage)))), # FROM GEARBOX + ("write_ptr", unsigned(len(range(len_storage)))), # FROM GEARBOX # CONTROL ("write_happens_this_cycle", 1), # TO GEARBOX @@ -69,10 +69,13 @@ class GearboxFlowControl(Elaboratable): self.out_width = out_width self.len_storage = len_storage - self.bus = GearboxBus(len_storage=len_storage) + self.bus = GearboxFCBus(len_storage=len_storage) + print(len(self.bus.read_ptr)) def elaborate(self, platform): + m = Module() + # The top-level flow control logic works as follows. # First, we determine which operations are *possible* based on the read/write indices # and the index disambiguator bit: @@ -140,6 +143,8 @@ class ArbitraryGearbox(Elaboratable): m = Module() loop = Signal(1) len_storage = self.in_width + self.out_width + m.submodules.flow_controller = flow_controller = GearboxFlowControl(in_width=self.in_width, out_width=self.out_width, len_storage=len_storage) + #storage = Signal(len_storage, reset=0b001_010_011_100_101_110_111) #storage = Signal(len_storage, reset= 0b111_110_101_100_011_010_001) @@ -190,7 +195,7 @@ class ArbitraryGearbox(Elaboratable): with m.If(self.bus.fault == 0): # read index update: - with m.If(read_happens_this_cycle == 1): + with m.If(0 == 1): with m.If(read_ptr + self.out_width >= len_storage): m.d.sync += read_ptr.eq(read_ptr + self.out_width - len_storage) with m.Else(): @@ -212,7 +217,7 @@ class ArbitraryGearbox(Elaboratable): )) # write index update: - with m.If(write_happens_this_cycle == 1): + with m.If(0 == 1): with m.If(write_ptr + self.in_width <= len_storage): m.d.sync += write_ptr.eq(write_ptr + self.in_width - len_storage) with m.Else(): -- GitLab