Complete the code to declare a memory block with 8 locations.
type memory_array is array (0 to 7) of std_logic_vector(7 downto 0); signal memory : memory_array := (others => (others => '0')); -- Memory has [1] locations
The memory block is declared with 8 locations indexed from 0 to 7.
Complete the code to read data from memory at address 'addr'.
process(clk) begin if rising_edge(clk) then data_out <= memory([1]); end if; end process;
The address signal 'addr' is used to index the memory for reading data.
Fix the error in the write process to store data on rising clock edge.
process(clk) begin if rising_edge(clk) then if write_enable = '1' then memory([1]) <= data_in; end if; end if; end process;
The address signal 'addr' specifies where to write the input data in memory.
Fill both blanks to create a memory block with 16 locations and 8-bit width.
type memory_array is array (0 to [1]) of std_logic_vector([2] downto 0); signal memory : memory_array;
The memory has 16 locations indexed 0 to 15, and each location is 8 bits wide (7 downto 0).
Fill all three blanks to write data to memory only when write_enable is active and clock rises.
process([1]) begin if rising_edge([2]) then if [3] = '1' then memory(addr) <= data_in; end if; end if; end process;
The process is sensitive to 'clk', the rising edge of 'clk' triggers the write, and 'write_enable' controls if data is written.
