T
TweedleDee
Guest
Disclaimer: I'm fairly new to VHDL
I am trying to do operations on my accumulator using different bits of
the instruction register. For instance, bit 2 will clear A and bit 3
will increment A. I want these operations to be able to happen in one
cycle with one instruction in order (e.g. Clear A, then increment).
This piece of code is what I came up with but it will only do one of
the operations, not both. I could break these down into different
clock cycles, but I'm hoping there is a way to do it in one. Any
ideas?
process (clk) begin
if rising_edge (clk) then
if en_execute = '1' then
if IR(2) = '1' then --clear accumulator
A <= "00000000";
end if;
if IR(3) = '1' then --increment accumulator
A <= A + 1;
end if;
end if;
end if;
end process;
I am trying to do operations on my accumulator using different bits of
the instruction register. For instance, bit 2 will clear A and bit 3
will increment A. I want these operations to be able to happen in one
cycle with one instruction in order (e.g. Clear A, then increment).
This piece of code is what I came up with but it will only do one of
the operations, not both. I could break these down into different
clock cycles, but I'm hoping there is a way to do it in one. Any
ideas?
process (clk) begin
if rising_edge (clk) then
if en_execute = '1' then
if IR(2) = '1' then --clear accumulator
A <= "00000000";
end if;
if IR(3) = '1' then --increment accumulator
A <= A + 1;
end if;
end if;
end if;
end process;