I am trying to copy a simple existing CPU inside a microcontroller.
For initial testing purposes I tried to set the program counter to start value 0x000 and hoping for a change at the "instruction-bus", these are my two VHDL-entities involved:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity MDT90P01 is
port (
pc: out std_logic_vector(8 downto 0);
c0: in std_logic;
w_reg_top: in std_logic_vector(3 downto 0);
instruction: in std_logic_vector(10 downto 0)
);
end MDT90P01;
architecture Behavioral of MDT90P01 is
begin
process(c0)
begin
if(falling_edge(c0)) then
pc <= "000000000";
end if;
end process;
end Behavioral;
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
USE IEEE.numeric_std.all;
entity Instruction_Memory is
port (
pc: in std_logic_vector(8 downto 0);
instruction: out std_logic_vector(10 downto 0);
c0: in std_logic
);
end Instruction_Memory;
architecture Behavioral of Instruction_Memory is
type ROM_type is array (0 to 511) of std_logic_vector(10 downto 0);
constant rom_data: ROM_type:= (
"10010000110",
"10010000110",
(others=>'0')
);
begin
process(c0)
begin
if(rising_edge(c0)) then
instruction <= rom_data(to_integer(unsigned(pc)));
end if;
end process;
end Behavioral;
But ModelSim-Altera only shows me this, I expected "instruction" to be "10010000110" but it isn't - why?