From 2cc86003da0b757ffc10a17f92b8804fea944257 Mon Sep 17 00:00:00 2001 From: Daniel Benusovich Date: Tue, 5 Mar 2019 22:01:30 -0800 Subject: [PATCH] Remove WalkingPriorityEncoder. This module is OBE and can be recalled via git later. --- TLB/src/WalkingPriorityEncoder.py | 45 ----------------------- TLB/test/test_walking_priority_encoder.py | 32 ---------------- 2 files changed, 77 deletions(-) delete mode 100644 TLB/src/WalkingPriorityEncoder.py delete mode 100644 TLB/test/test_walking_priority_encoder.py diff --git a/TLB/src/WalkingPriorityEncoder.py b/TLB/src/WalkingPriorityEncoder.py deleted file mode 100644 index 6be4d9b3..00000000 --- a/TLB/src/WalkingPriorityEncoder.py +++ /dev/null @@ -1,45 +0,0 @@ -from nmigen import Array, Module, Signal -from nmigen.lib.coding import PriorityEncoder, Decoder - -class WalkingPriorityEncoder(): - - def __init__(self, width): - # Internal - self.current = Signal(width) - self.encoder = PriorityEncoder(width) - - # Input - self.write = Signal(1) - self.input = Signal(width) - - # Output - self.match = Signal(1) - self.output = Signal(width) - - def elaborate(self, platform=None): - m = Module() - - m.submodules += self.encoder - - with m.If(self.write == 0): - with m.If(self.encoder.n == 0): - m.d.sync += [ - self.output.eq(self.encoder.o), - self.match.eq(1) - ] - m.d.sync += self.current.eq(self.current ^ \ - (1 << self.encoder.o)) - m.d.sync += self.encoder.i.eq(self.current ^ \ - (1 << self.encoder.o)) - - with m.Else(): - m.d.sync += self.match.eq(0) - m.d.sync += self.encoder.i.eq(0) - - with m.Else(): - m.d.sync += self.encoder.i.eq(self.input) - m.d.sync += self.current.eq(self.input) - m.d.sync += self.encoder.i.eq(self.input) - m.d.sync += self.match.eq(0) - - return m diff --git a/TLB/test/test_walking_priority_encoder.py b/TLB/test/test_walking_priority_encoder.py deleted file mode 100644 index 370545b7..00000000 --- a/TLB/test/test_walking_priority_encoder.py +++ /dev/null @@ -1,32 +0,0 @@ -import sys -sys.path.append("../src") -sys.path.append("../../TestUtil") - -from nmigen.compat.sim import run_simulation - -from WalkingPriorityEncoder import WalkingPriorityEncoder - -from test_helper import assert_eq, assert_ne - -def testbench(dut): - yield dut.write.eq(1) - yield dut.input.eq(5) - yield dut.output.eq(3) - yield - yield dut.write.eq(0) - yield dut.input.eq(0) - yield - yield - yield - yield - yield - yield - yield - yield - output = yield dut.output - #assert_eq("Output", output, 1) - -if __name__ == "__main__": - dut = WalkingPriorityEncoder(4) - run_simulation(dut, testbench(dut), vcd_name="Waveforms/cam_walking_priority_encoder.vcd") - print("WalkingPriorityEncoder Unit Test Success") -- 2.30.2