Professional Documents
Culture Documents
ByUjash Poshiya
General Concepts
A memory is an array of storage locations
-Each
m bits
0 1 2 3 4 5 6
with a unique address Like a collection of registers, but with optimized implementation
Memory Modeling
To help modeling of memory, Verilog provides support for two dimensions arrays. Behavioral models of memories are modeled by declaring an array of register variables; any word in the array may be accessed using an index into the array. A temporary variable is required to access a discrete bit within the array.
Syntax:-
data_out_it_0 = data_out[0];
Memory Types
1)Volatile memory:Volatile means that all data is lost when The chip is power down. ExRAM,SRAM,on-chip memory. 2)Non Volatile memory:It retains data even when not powered. ExROM, Flash Memory
Types Of RAM
SRAM:Static RAM (SRAM) has the advantage of being faster than
DRAM, although the disadvantage is that it is more expensive. Power requirement of SRAM is low,but it depends on the clock speed.
DRAM:Dynamic RAM is less expensive, and therefore it is the most widely used .It uses less area on the chip.
ROM
It is a non volatile memory. ROMs have traditionally been used in computer systems to store configuration data, such as bootstrap or BIOS code, which requires fast access. There are many types of ROM. EX- Mask ROM, PROM, EPROM, EEPROM
Flash Memory
It is same as EEPROM, which can be electrically erased and reprogrammed. Although flash memory is erased only one block or page at a time. it is much less expensive than EEPROM. This has made it the most popular form of non-volatile, solid-state storage. It has been wildly successful in consumer devices,such as music players, digital cameras, and game consols.
Read operation:-en = 1, wr = 0;
d_out driven with value of location given by address inputs.
Idle: en = 0
Single Port Syncronized RAM With Seperate Read And Write Address
-It is same as syncronus RAM but it is provided with enable input and also seperate read address input.
// Port A always @ (posedge clk) begin if (we_a) begin ram[addr_a] <= data_a; q_a <= data_a; end else begin q_a <= ram[addr_a]; end end
Continue
// Port B
always @ (posedge clk) begin if (we_b) begin ram[addr_b] <= data_b; q_b <= data_b; end else begin q_b <= ram[addr_b];
end
end
endmodule
input [4:0] addr; output reg [3:0] data; always @(posedge clk)
begin
if (en) case(addr) 4b0000: data <= 4b0010; 4b0001: data <= 4b0010; 4b0010: data <= 4b1110; 4b0011: data <= 4b0010;
Continue
4b0110: data <= 4b1100; 4b0111: data <= 4b0000;
Output