vGoodtimes
Advanced Member level 4
ok, so you attempted to make something similar to a spinlock. However, that isn't needed or possible in VHDL.
The nested if-else statements will perform the function you want. It forces the add/complement/load operations to only occur when the error flag is 0.
Specifically:
This is the nested if-else statement. As you can see, if clear is set clear works. clear always works. However add/complement/load are inside of an elsif, and can only be used if the error flag is not set.
It may help you if you realize that you are describing hardware vs describing logic that would run on an existing piece of hardware.
The nested if-else statements will perform the function you want. It forces the add/complement/load operations to only occur when the error flag is 0.
Specifically:
Code:
process (clk) is
begin
if rising_edge(clk) then
if clear = '1' then
-- dReg should be cleared
-- any error flag should be cleared.
elsif error_flag = '0' then
if load = '1' then
-- code for load
elsif add = '1' then
--code for the addition and to set the error_flag.
elsif complement = '1' then
-- code for complement
end if;
end if;
end if;
end process;
It may help you if you realize that you are describing hardware vs describing logic that would run on an existing piece of hardware.