1 / 7

TOPIC : Memory modeling

TOPIC : Memory modeling. Module 4.1 : Memory modeling in Verilog. Memories. In digital simulation, one often needs to model register files, RAMs, and ROMs. Memories are modeled in Verilog simply as an array of registers.

colin
Télécharger la présentation

TOPIC : Memory modeling

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. TOPIC : Memory modeling Module 4.1 : Memory modeling in Verilog

  2. Memories • In digital simulation, one often needs to model register files, RAMs, and ROMs. Memories are modeled in Verilog simply as an array of registers. • Each element of the array is known as a word. Each word can be one or more bits. It is important to differentiate between n 1-bit registers and one n-bit register. • A particular word in memory is obtained by using the address as a memory array subscript.

  3. Memory • Different types and sizes of memory, register file, stack, etc., can be formed by extending the vector concept. Thus the decleration Reg [15:0] memory[511:0]; • Declared an array called memory; it has 512 locations. Each location is 16 bits wide. The value of any chosen location can be assigned to a selected register or vice-versa; this constitutes memory reading or writing. The index used to refer a memory location can be a number or an algebraic expression which reduces to an integral value – positive, zero, or negative. • B = mem[3] //data stored at mem[3] is assigned to B

  4. Memory decleration • Reg mem1bit[0:1023] //Memory mem1bit 1k 1-bit words. • Reg [7:0] membyte[0:1023]; //Memory membyte with 1k 8-bit words (bytes) • Membyte [511] //Fetches 1 byte word address is 511.

  5. Initialization Memory from file • Verilog provides a very useful system task to initialize memories from a data file. Two tasks are provided to read numbers in binary or hexadecimal format. Keywords $readmemb and $readmemh are used to initialize memories : • Usage: • $readmemb(“<file_name>”, <memory_name>); • $readmemb(“<file_name>”,<memory_name>,<start_addr>,<finish_addr>); • NOTE : <start_addr>,<finish_addr> are optional.

  6. Initializing memory example

More Related