Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to declare a constant ROM array of 8 elements.
VHDL
type rom_array is array (0 to 7) of std_logic_vector(7 downto 0); constant ROM : rom_array := ([1]);
Attempts:
3 left
💡 Hint
Common Mistakes
Using 7-bit vectors instead of 8-bit.
Using single characters instead of 8-bit vectors.
Not enclosing elements in double quotes.
✗ Incorrect
The ROM constant must be initialized with 8 elements of 8-bit std_logic_vector values.
2fill in blank
mediumComplete the code to read data from ROM at address 'addr'.
VHDL
process(addr) begin
data_out <= ROM([1]);
end process;Attempts:
3 left
💡 Hint
Common Mistakes
Adding or subtracting from the address.
Using the output signal as index.
Using the ROM name instead of the address.
✗ Incorrect
The ROM is indexed by the address signal 'addr' to output the stored data.
3fill in blank
hardFix the error in the ROM declaration by completing the missing part.
VHDL
constant ROM : rom_array := (0 => "00000001", 1 => "00000010", [1]);
Attempts:
3 left
💡 Hint
Common Mistakes
Using a single character instead of an 8-bit vector.
Using a character literal instead of a string.
Using a numeric zero without quotes.
✗ Incorrect
The 'others' keyword fills all unspecified indices with the given 8-bit vector.
4fill in blank
hardFill both blanks to complete the ROM read process with synchronous clock.
VHDL
process(clk) begin if rising_edge(clk) then data_out <= ROM([1]); end if; end process;
Attempts:
3 left
💡 Hint
Common Mistakes
Using clock or output signals as index.
Reading ROM outside the clocked process.
✗ Incorrect
The ROM is read synchronously using the address signal 'addr' on clock rising edge.
5fill in blank
hardFill all three blanks to declare a ROM with 16 elements, initialize it, and read data synchronously.
VHDL
type rom_array is array (0 to 15) of std_logic_vector(7 downto 0); constant ROM : rom_array := ([1]); process(clk) begin if rising_edge(clk) then data_out <= ROM([2]); end if; end process;
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong number of elements in ROM initialization.
Using wrong signals for indexing or clock.
✗ Incorrect
The ROM is initialized with 16 8-bit values, read synchronously on clock rising edge using 'addr'.
