From 0f95f3efbe4879bcf8b24aafda1c10dd95e9dd40 Mon Sep 17 00:00:00 2001 From: Julian Blake Kongslie Date: Tue, 23 Mar 2021 19:01:29 -0700 Subject: Replace dibble dabble algorithm with variant that tests after the add. This makes it really easy to support odd bases. --- top.sv | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'top.sv') diff --git a/top.sv b/top.sv index 4acfdeb..cbb5b55 100644 --- a/top.sv +++ b/top.sv @@ -1,5 +1,6 @@ module top #( FIB_BITS = 16 + , FIB_BASE = 10 , ROM_BITS = 8 ) ( input bit clk // verilator public @@ -58,6 +59,7 @@ bit [7:0] fib_a_data; ntoa #( .BITS(FIB_BITS) + , .BASE(FIB_BASE) ) fib_ntoa ( .clk(clk) , .reset(reset) @@ -97,9 +99,9 @@ always_ff @(posedge clk) begin if (!tx_valid && (data != 0)) begin tx_valid = 1; tx_data = data; - addr = addr + 1; + ++addr; end else if (data == 0) begin - addr = addr + 1; + ++addr; state = state.next; end end -- cgit v1.2.3