diff --git a/lib/misc/gpio_wb.vhd b/lib/misc/gpio_wb.vhd index 6df62c0..20cdfa0 100644 --- a/lib/misc/gpio_wb.vhd +++ b/lib/misc/gpio_wb.vhd @@ -3,6 +3,10 @@ USE IEEE.STD_LOGIC_1164.ALL; USE IEEE.NUMERIC_STD.ALL; ENTITY gpio_wb IS + Generic + ( + f_sysclk_hz : natural := 100E6 + ); Port ( CLK_I : in STD_LOGIC; @@ -30,13 +34,14 @@ END gpio_wb; ARCHITECTURE behavior OF gpio_wb IS constant num_timers : natural := 2; + constant ncycles_usec : natural := f_sysclk_hz/1E6; signal gpo0_reg : unsigned(31 downto 0); signal gpo1_reg : unsigned(31 downto 0); signal gpi0_reg : unsigned(31 downto 0); 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 99; + subtype tick_usec_t is natural range 0 to ncycles_usec-1; signal tick_usec : tick_usec_t; signal cnt_usec : unsigned(31 downto 0); signal cnt_sec : unsigned(31 downto 0);