From bd42aab5d9d1d44ffdb32ac57efbf762ed2e8e88 Mon Sep 17 00:00:00 2001 From: Sean Anderson Date: Sun, 16 Oct 2022 18:53:47 -0400 Subject: [PATCH] descrambler: Rename unscrambled* to descrambled* The descrambler should descramble, not unscramble. Signed-off-by: Sean Anderson --- rtl/descramble.v | 18 +++++++++--------- tb/descramble.py | 8 ++++---- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/rtl/descramble.v b/rtl/descramble.v index 6cc0ad4..16fdc21 100644 --- a/rtl/descramble.v +++ b/rtl/descramble.v @@ -10,12 +10,12 @@ module descramble ( input [1:0] scrambled, scrambled_valid, input signal_status, test_mode, output reg locked, - output reg [1:0] unscrambled, unscrambled_valid + output reg [1:0] descrambled, descrambled_valid ); reg relock, relock_next, locked_next; initial relock = 0; - reg [1:0] ldd, unscrambled_next; + reg [1:0] ldd, descrambled_next; reg [10:0] lfsr, lfsr_next; /* @@ -45,7 +45,7 @@ module descramble ( always @(*) begin ldd = { lfsr[8] ^ lfsr[10], lfsr[7] ^ lfsr[9] }; - unscrambled_next = scrambled ^ ldd; + descrambled_next = scrambled ^ ldd; /* * We must invert scrambled before adding it to the lfsr in @@ -62,14 +62,14 @@ module descramble ( idle_counter_next = idle_counter; if (scrambled_valid[1]) begin - if (unscrambled_next[1] && unscrambled_next[0]) + if (descrambled_next[1] && descrambled_next[0]) idle_counter_next = idle_counter - 2; - else if (unscrambled_next[0]) + else if (descrambled_next[0]) idle_counter_next = idle_counter - 1; else idle_counter_next = CONSECUTIVE_IDLES; end else if (scrambled_valid[0]) begin - if (unscrambled_next[1]) + if (descrambled_next[1]) idle_counter_next = idle_counter - 1; else idle_counter_next = CONSECUTIVE_IDLES; @@ -97,21 +97,21 @@ module descramble ( end always @(posedge clk) begin - unscrambled <= unscrambled_next; + descrambled <= descrambled_next; if (signal_status) begin lfsr <= lfsr_next; idle_counter <= idle_counter_next; relock <= relock_next; unlock_counter <= unlock_counter_next; locked <= locked_next; - unscrambled_valid <= scrambled_valid; + descrambled_valid <= scrambled_valid; end else begin lfsr <= 0; idle_counter <= CONSECUTIVE_IDLES; relock <= 0; unlock_counter <= 0; locked <= 0; - unscrambled_valid <= 0; + descrambled_valid <= 0; end end diff --git a/tb/descramble.py b/tb/descramble.py index dfef838..1cd1909 100644 --- a/tb/descramble.py +++ b/tb/descramble.py @@ -69,14 +69,14 @@ async def test_descramble(descrambler, valids): await RisingEdge(descrambler.locked) while descrambler.locked.value: await RisingEdge(descrambler.clk) - valid = descrambler.unscrambled_valid.value + valid = descrambler.descrambled_valid.value if valid == 0: pass elif valid == 1: - outs.append(descrambler.unscrambled[1].value) + outs.append(descrambler.descrambled[1].value) else: - outs.append(descrambler.unscrambled[1].value) - outs.append(descrambler.unscrambled[0].value) + outs.append(descrambler.descrambled[1].value) + outs.append(descrambler.descrambled[0].value) best_corr = -1 best_off = None