From d25b4107ef00ca8b401423013db3d84bc0c10951 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Joachim=20Stro=CC=88mbergson?= <joachim@secworks.se>
Date: Thu, 21 Jun 2018 14:47:40 +0200
Subject: Fixed bad mistake on reset signal. Minor cleanup.

---
 rtl/alpha_fmc_top.v | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/rtl/alpha_fmc_top.v b/rtl/alpha_fmc_top.v
index a86a2c6..4d7fcac 100644
--- a/rtl/alpha_fmc_top.v
+++ b/rtl/alpha_fmc_top.v
@@ -210,6 +210,7 @@ module alpha_fmc_top
   reg [15 : 0] toggle_ctr_new;
 
   reg toggle_reg;
+  reg toggle_new;
   reg toggle_we;
 
   assign gpio_a = {7'b0101010, toggle_reg};
@@ -217,9 +218,9 @@ module alpha_fmc_top
 
   always @(posedge sys_clk)
     begin: sys_clk_toggle_reg_update
-      if (!reset_n)
+      if (!sys_rst_n)
         begin
-          toggle_ctr_reg <= 16'h0;
+          toggle_ctr_reg <= 32'h0;
           toggle_reg     <= 1'b0;
         end
       else
@@ -227,22 +228,22 @@ module alpha_fmc_top
           toggle_ctr_reg <= toggle_ctr_new;
 
           if (toggle_we)
-            toggle_reg <= ~toggle_reg;
+            toggle_reg <= toggle_new;
         end
     end
 
   always @*
     begin : sys_clk_toggle
+      toggle_new = ~toggle_reg;
+      toggle_we  = 1'b0;
+
       if (toggle_ctr_reg == TOGGLE_DELAY_CYCLES)
         begin
-          toggle_ctr_new = 16'h0;
+          toggle_ctr_new = 32'h0;
           toggle_we      = 1'b1;
         end
       else
-        begin
-          toggle_ctr_new = toggle_ctr_reg + 1'b1;
-          toggle_we      = 1'b0;
-        end
+        toggle_ctr_new = toggle_ctr_reg + 1'b1;
     end
 
 endmodule // alpha_fmc_top
-- 
cgit v1.2.3