N
Niv
Guest
Is it possible to use a generic to control how a piece of code is
reset?
i.e.
ENTITY...........................
GENERIC(
deglitch_depth : IN NATURAL := 3;
sync_reset : IN BOOLEAN := FALSE
);
PORT (
clk : IN std_logic;
reset_n : IN std_logic;
async_in : IN std_logic;
deglitched_out : OUT std_logic
);
ARCHITECTURE................
BEGIN ..................etc
PROCESS..................
IF sync_reset = TRUE THEN
IF reset_n = '0' THEN
signals <= '0';
ELSIF rising_edge(clk) THEN
signal assignments;
END IF;
ELSE -- sync_reset is FALSE
IF rising_edge(clk) THEN
IF reset_n = '0' THEN
signals <= '0';
ELSE
signal assignments;
END IF;
END IF;
END IF; -- (Generic).
The idea is to create a small block of code that is acceptable to many
users, but sometimes the reset has to be async & sometimes sync,
depending on where/how it's used.
Would this need a generate statement, or something else to get it to
work, if at all possible?
TIA, Niv.
reset?
i.e.
ENTITY...........................
GENERIC(
deglitch_depth : IN NATURAL := 3;
sync_reset : IN BOOLEAN := FALSE
);
PORT (
clk : IN std_logic;
reset_n : IN std_logic;
async_in : IN std_logic;
deglitched_out : OUT std_logic
);
ARCHITECTURE................
BEGIN ..................etc
PROCESS..................
IF sync_reset = TRUE THEN
IF reset_n = '0' THEN
signals <= '0';
ELSIF rising_edge(clk) THEN
signal assignments;
END IF;
ELSE -- sync_reset is FALSE
IF rising_edge(clk) THEN
IF reset_n = '0' THEN
signals <= '0';
ELSE
signal assignments;
END IF;
END IF;
END IF; -- (Generic).
The idea is to create a small block of code that is acceptable to many
users, but sometimes the reset has to be async & sometimes sync,
depending on where/how it's used.
Would this need a generate statement, or something else to get it to
work, if at all possible?
TIA, Niv.