Skip to content

Latest commit

 

History

History

Day-43

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

In this Verilog code

  1. We have a module named ROM with an 8-bit address input and an 8-bit data output.
  2. The ROM data is defined using an array rom_data, where each element corresponds to a memory location.
  3. Inside the initial block, you can initialize the ROM with your desired values. In the example, I've initialized it with sequential values for demonstration purposes. You should replace these values with your own data.
  4. The always block continuously updates the data output based on the address input. It reads the value stored at the specified memory location and assigns it to the data output.

You can customize the ROM data by modifying the values in the initial block to store the data you need in the ROM.

In this testbench

  1. We instantiate the ROM module.
  2. The initial block initializes the testing process and loops through all 256 possible addresses.
  3. For each address, you need to specify the expected data value in the case statement based on your ROM data.
  4. The testbench applies each address to the ROM and compares the actual data output with the expected data.
  5. It prints whether the test passed or failed for each address.

You should replace the expected data values in the case statement with the correct data values based on your ROM initialization. This testbench provides a basic framework for testing your 8-bit ROM, and you can expand it to cover all 256 addresses with their respective expected data.