case state is
when sfetch =>
addr <= pc;
we <= '0';
pc <= pc + 1;
state <= sread;
data <= "ZZZZZZZZ"; -- optional
when sread =>
-- read from memory, data is ready next clock
state <= sexec;
when sexec =>
-- Read data
case data(7 downto 6) is
-- Load
when "00" =>
we <= '0';
addr <= data(5 downto 0);
state <= sload;
-- Store
when "01" =>
we <= '1';
addr <= data(5 downto 0);
data <= reg;
state <= sstore;
-- Add
when "10" =>
reg <= std_logic_vector(unsigned(reg) + unsigned(data(5 downto 0)));
state <= sfetch;
-- Jump
when "11" =>
pc <= data(5 downto 0);
state <= sfetch;
when others => null;
end case;
when sload =>
-- read from memory, data is ready next clock
state <= swriteback;
when swriteback =>
reg <= data; -- Load write back
state <= sfetch; -- Fetch Next Instruction
when sstore =>
-- write to memory, data is ready next clock
state <= sfetch;
when others => null;
end case;
deluca wrote:-di non operazione (NOP)....
che non fa mai male e ti serve in quei timing
che ogni tanto fanno impazzire specie nella sincronizzazione
e wait-state di ram esterne più lente.
Users browsing this forum: No registered users and 14 guests