Complete the code to declare a memory array of 16 elements, each 8 bits wide.
type memory_array is array (0 to 15) of std_logic_vector([1] downto 0);
The memory elements are 8 bits wide, so the index goes from 7 down to 0.
Complete the code to initialize the memory with all zeros.
signal memory : memory_array := (others => (others => [1]));Each bit in the std_logic_vector must be initialized with the character '0'.
Fix the error in the memory initialization line to correctly assign a hex value to the first element.
memory(0) <= x"[1]";
Hexadecimal values must use digits 0-9 and letters A-F only. "0F" is valid.
Fill both blanks to create a process that initializes memory on reset.
process(clk, reset) begin if reset = '[1]' then memory <= (others => (others => '[2]')); end if; end process;
Reset is usually active high ('1'), and std_logic values require single quotes.
Fill all three blanks to create a memory initialization using a for-generate statement.
gen_init: for i in 0 to 15 generate memory(i) <= (others => '[1]') when i [2] 0 else (others => '[3]'); end generate;
The first element is set to '1', others to '0'. The condition uses '=' to compare i to 0.
