530 likes | 662 Views
COMP541 Memories - I. Montek Singh Feb 25, 2010. Topics. Midterm Test Thursday after Spring Break Lab Preview: VGA character terminal Overview of Memory Types ROMs: PROMs, FLASH, etc. RAMs Random-Access Memory (RAM) Static today Dynamic next. Lab: VGA Display Driver Architecture.
E N D
COMP541Memories - I Montek Singh Feb 25, 2010
Topics • Midterm Test • Thursday after Spring Break • Lab Preview: VGA character terminal • Overview of Memory Types • ROMs: PROMs, FLASH, etc. • RAMs • Random-Access Memory (RAM) • Static today • Dynamic next
Lab: VGA Display Driver Architecture • No frame buffer • Character terminal
Character Memory • Dual ported • Memory mapped • CPU writes • Could read also • How many characters?
Bitmap Memory • What bitmap size? • 5x7 at least • Codes • http://www.piclist.com/techref/datafile/charsets.htm • http://www.piclist.com/techref/datafile/charset/8x8.htm • Indexed by character memory • So what code to store in character memory? • What size should memory be?
VGA driver • Just sends hsync, vsync • Track current row/column • something the Timing Generator should provide the VGA Driver • Generates color • When valid • Maybe smaller than VGA • What character code? ASCII? • How many rows and columns?
Possibilities • Code color into some bits of character? • Other possibilities • Sprites for games? • Your own Nintendo • Ideas?
RAM on FPGA • Ours has 28 blocks, each 18Kb (bits, not bytes!) • They call it block RAM • Block RAM: One or two ports, and several possible layouts • Often you’ll use it as a 16Kb RAM module
Using from Verilog • It’s a primitive • Instantiate a block (here called R1) RAMB16_S1 R1( .DO(out), // 1-bit Data Output .ADDR(addr), // 14-bit Address Input .CLK(clk), // Clock .DI(in), // 1-bit Data Input .EN(ena), // RAM Enable Input .SSR(1’b0), // Synchronous Set/Reset Input .WE(we) // Write Enable Input );
4-Wide Block RAMB16_S4 RAMB16_S4_inst ( .DO(DO), // 4-bit Data Output .ADDR(ADDR), // 12-bit Address Input .CLK(CLK), // Clock .DI(DI), // 4-bit Data Input .EN(EN), // RAM Enable Input .SSR(SSR), // Synchronous Set/Reset Input .WE(WE) // Write Enable Input );
Wider Have Parity RAMB16_S18 RAMB16_S18_inst ( .DO(DO), // 16-bit Data Output .DOP(DOP), // 2-bit parity Output .ADDR(ADDR), // 10-bit Address Input .CLK(CLK), // Clock .DI(DI), // 16-bit Data Input .DIP(DIP), // 2-bit parity Input .EN(EN), // RAM Enable Input .SSR(SSR), // Synchronous Set/Reset Input .WE(WE) // Write Enable Input );
Can Initialize Block RAM RAMB16_S1 #( .INIT(1'b0), // Value of output RAM registers at startup .SRVAL(1'b0), // Output value upon SSR assertion .WRITE_MODE("WRITE_FIRST"), // WRITE_FIRST, READ_FIRST or NO_CHANGE // The following INIT_xx declarations specify the initial contents of the RAM // Address 0 to 4095 .INIT_00(256'h0000000000000000000000000000000000000000000000000000000000000F1F), .INIT_01(256'h0000000000000000000000000000000000000000000000000000000000000000), … .INIT_3E(256'h0000000000000000000000000000000000000000000000000000000000000000), .INIT_3F(256'h0000000000000000000000000000000000000000000000000000000000000000) ) RAMB16_S1_inst ( .DO(data), // 1-bit Data Output .ADDR(addr), // 14-bit Address Input .CLK(clk), // Clock .DI(DI), // 1-bit Data Input .EN(EN), // RAM Enable Input .SSR(SSR), // Synchronous Set/Reset Input .WE(WE) // Write Enable Input ); Note that addresses go right to left, top to bottom
Synthesizer Can Also Infer • Careful how you specify (see XST manual). module inferRAM(clk, addr, data, we); input clk; input [8:0] addr; // 512 locations output [7:0] data; // by 8 bits input we; reg [7:0] mem [511:0]; reg [8:0] ra; always @ (posedge clk) begin if(we) mem[addr] <= data; ra <= addr; end assign data = mem[ra]; endmodule
Look at Test Code • RAM testing example • I’ll post online for tomorrow’s lab • Note how memory values are specified • Addresses go right-to-left, top-to-bottom • See the Constraints Guide and Library manuals in Xilinx docs
Types of Memory • Many dimensions • Read Only vs Read/Write (or write seldom) • Volatile vs Non-Volatile • Requires refresh or not • Look at ROM first to examine interface
Non-Volatile Memory Technologies • Mask (old) • Fuses (old) • Electrically erasable
Details of ROM • Memory that is permanent • k address lines • 2k items • n bits
Resulting Programming In truth, they’re laid out in 2D (row, col)
Mask ROMs • Oldest technology • Originally “mask” used as last step in manufacturing • Specify metal layer (connections) • Used for volume applications • Long turnaround • Used for applications such as embedded systems and, in the old days, boot ROM
Programmable ROM (PROM) • First ones had fusible links • High voltage would blow out links • Fast to program • Single use
UV EPROM • Erasable PROM • Common technologies used UV light to erase complete device • Took about 10 minutes • Holds state as charge in very well insulated areas of the chip • Nonvolatile for several (10?) years
EEPROM • Electrically Erasable PROM • Similar technology to UV EPROM • Erased in blocks by higher voltage • Programming is slower than reading • Some called flash memory • Digital cameras, MP3 players, BIOS • Limited life • Some support individual word write, some block • One on Xess board has 5 blocks • Has a boot block that is carefully protected
How Flash Works • Special transistor with floating gate • This is part of device surrounded by insulation • So charge placed there can stay for years • Aside: some newer devices store multiple bits of info in a cell • Interested in this? If so, we can cover in more detail w/ transistors
Read/Write Memories • Flash is obviously writeable • But not meant to be written rapidly (say at CPU rates) • And often by blocks (disk replacement) • On to RAM
Random Access Memories • So called because it takes same amount of time to address any particular location • Not quite true for modern DRAMs • First look at asynchronous static RAM • Ones on Xilinx chip synchronous • Data available at clock edges, like registers • One on board can be both
Simple View of RAM • Of some word size n • Some capacity 2k • k bits of address line • Maybe have read line • Strictly speaking may not need • Have a write line
1K x 16 memory • Variety of sizes • From 1-bit wide • Issue is no. of pins • Memory size often specified in bytes • This would be 2KB memory • 10 address lines and 16 data lines
Writing • Sequence of steps • Setup address lines • Setup data lines • Activate write line (maybe a pos edge)
Reading • Steps • Setup address lines • Activate read line • Data available after specified amt of time • For async • Synchronous memories use a clock
Chip Select • Usually a line to enable the chip • Why?
Static vs Dynamic RAM • SRAM vs DRAM • DRAM stores charge in capacitor • Disappears after short period of time • Must be refreshed • SRAM easier to use • Uses transistors (think of it as latch) • Faster • More expensive per bit • Smaller sizes
Structure of SRAM • Control logic • One memory cell per bit • Cell consists of one or more transistors • Not really a latch made of NANDs/NORs, but logically equivalent
Simple Organization • In reality, more complex • Note that only one wordline H at a time
Bit Slice • Cells connected to form 1 bit position • Word Select gates one latch from address lines • Note it selects Reads also • B (and B’) set by R/W, Data In and BitSelect • Funny thing here when you write. What is it?
Bit Cells Example: Z 0 Z 1
Bit Slice can Become Module • Basically bit slice is a X1 memory • Next
16 X 1 RAM “Chip” • Now shows decoder
Row/Column • If RAM gets large, there is a large decoder • Also run into chip layout issues • Larger memories usually “2D” in a matrix layout • Next Slide
16 X 1 RAM as 4 X 4 Array • Two decoders • Row • Column • Address just broken up • Not visible from outside on SRAMs
Change to 8 X 2 RAM • Minor change in logic • Also pinouts • What’s different?
Realistic Sizes • Imagine 256K memory as 32K X 8 • One column layout would need 15-bit decoder with 32K outputs! • Can make a square layout with 9-bit row and 6-bit column decoders
SRAM Performance • Current ones have cycle times in low nanoseconds (say 2.5ns) • Used as cache (typically on-chip or off-chip secondary cache) • Sizes up to 8Mbit or so for fast chips • SRAMs also common for low power
Wider Memory • What if you don’t have enough bit width?
Larger/Wider Memories • Made up from sets of chips • Consider a 64K by 8 RAM