diff --git a/lib/misc/gpio_wb.vhd b/lib/misc/gpio_wb.vhd index 32ddf4d..2e7bc8a 100644 --- a/lib/misc/gpio_wb.vhd +++ b/lib/misc/gpio_wb.vhd @@ -42,7 +42,7 @@ ARCHITECTURE behavior OF gpio_wb IS signal gpi1_reg : unsigned(31 downto 0); -- Signals to form an timer generating an interrupt every microsecond subtype tick_usec_t is natural range 0 to ncycles_usec-1; - signal tick_usec : tick_usec_t; + signal tick_usec : tick_usec_t := 0; signal cnt_usec : unsigned(31 downto 0); signal cnt_sec : unsigned(31 downto 0); signal cnt_usec_preset : unsigned(31 downto 0); @@ -256,7 +256,7 @@ cnt_usec_clock: if cnt_usec_we = '1' then cnt_usec <= reg_data_wr; elsif cnt_usec_en = '1' then - if cnt_usec >= to_unsigned(1E6 - 1, 32) then + if to_01(cnt_usec) >= to_unsigned(1E6 - 1, 32) then cnt_usec <= (others => '0'); cnt_sec_en <= '1'; else @@ -293,7 +293,7 @@ proc_int_timer: elsif timer_cnt_we(i) = '1' then timer_cnt(i) <= reg_data_wr; elsif timer_en(i) = '1' then - if timer_cnt(i) >= timer_cmp(i) then + if to_01(timer_cnt(i)) >= timer_cmp(i) then timer_cnt(i) <= (others => '0'); if timer_inten(i) = '1' then if timer_irq(i) = '1' then