03 dram

Upload: vishal-samundre

Post on 10-Apr-2018

220 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/8/2019 03 Dram

    1/56

    The UNIVERSITY ofNORTH CAROLINA atCHAPEL HILL

    RAM Basics

    Anselmo Lastra

  • 8/8/2019 03 Dram

    2/56

    The UNIVERSITY ofNORTH CAROLINA atCHAPEL HILL

    TopicsVGA timing project

    Deadline Thursday

    Class time change

    Semester project topics

    RAMs

  • 8/8/2019 03 Dram

    3/56

    The UNIVERSITY ofNORTH CAROLINA atCHAPEL HILL

    ClassT

    imePreference for keeping TTh

    Unfortunately, no open time forall

  • 8/8/2019 03 Dram

    4/56

    The UNIVERSITY ofNORTH CAROLINA atCHAPEL HILL

    ProjectsSome have project already

    Polygon pipelineStopping points: Gouraud, texturing, etc.

    Ray caster/tracer

    Similar possible milestonesCan share common parts

  • 8/8/2019 03 Dram

    5/56

    The UNIVERSITY ofNORTH CAROLINA atCHAPEL HILL

    Simple Hdw View of RAM

    Some capacity 2k

    k bits of address linesOften multiplexed

    Maybeh

    ave read line, clock, ch

    ipselect

    Have a write enable line

  • 8/8/2019 03 Dram

    6/56

    The UNIVERSITY ofNORTH CAROLINA atCHAPEL HILL

    ReadingSetup address lines

    Activate enable, read/write line

    Data available after specified amt of time

  • 8/8/2019 03 Dram

    7/56

    The UNIVERSITY ofNORTH CAROLINA atCHAPEL HILL

    Writing

    Setup address lines

    Setup data lines

    Activate write line

  • 8/8/2019 03 Dram

    8/56

    The UNIVERSITY ofNORTH CAROLINA atCHAPEL HILL

    Static vs Dynamic RAMSRAM vs DRAM

    DRAM stores charge in whats essentially

    capacitorDisappears over short period of time

    Must be refreshed (rewritten/recharged)

    SRAM easier to use

    FasterMore expensive per bit

    Smaller sizes

  • 8/8/2019 03 Dram

    9/56

    The UNIVERSITY ofNORTH CAROLINA atCHAPEL HILL

    Stru

    ctu

    re of SRAMControl logic

    One memory cell per bitCell consists of one or more transistors

    Not really a latch made of logic

    Logic equivalent

  • 8/8/2019 03 Dram

    10/56

    The UNIVERSITY ofNORTH CAROLINA atCHAPEL HILL

    Bit SliceCells connected to form1 bit position

    Word Select gates one

    latch from address linesNote it selects Readsalso

    B (and B not) set byR/W, Data In andBitSelectFunny thing here whenyou write.What is it?

  • 8/8/2019 03 Dram

    11/56

    The UNIVERSITY ofNORTH CAROLINA atCHAPEL HILL

    Bit Slice can Become Modu

    le

    Basically bit sliceis a X1 memory

    Next

  • 8/8/2019 03 Dram

    12/56

    The UNIVERSITY ofNORTH CAROLINA atCHAPEL HILL

    16 X 1 RAMNowshows

    decoder

  • 8/8/2019 03 Dram

    13/56

    The UNIVERSITY ofNORTH CAROLINA atCHAPEL HILL

    Tri-StateHave three states: H, L, and Hi-Z

    High impedance

    Behaves like no output connection if inHi-Z state

    Allows connecting multiple outputs

  • 8/8/2019 03 Dram

    14/56

    The UNIVERSITY ofNORTH CAROLINA atCHAPEL HILL

    Mu

    ltiplexed with

    Hi-Z

    Normal behavior is bluearea

  • 8/8/2019 03 Dram

    15/56

    The UNIVERSITY ofNORTH CAROLINA atCHAPEL HILL

    Row/Colu

    mnIf RAM gets large, there is a largedecoder

    Also run into chip layout issues

    Larger memories usually 2D ina matrix layout

    Next Slide

  • 8/8/2019 03 Dram

    16/56

    The UNIVERSITY ofNORTH CAROLINA atCHAPEL HILL

    16 X 1 as 4 X 4 ArrayTwodecoders

    Row

    Column

    Address just

    brokenu

    pNot visiblefrom outside

  • 8/8/2019 03 Dram

    17/56

    The UNIVERSITY ofNORTH CAROLINA atCHAPEL HILL

    Ch

    ange to 4 X 2 RAMMinor changein logic

    Also pinouts

  • 8/8/2019 03 Dram

    18/56

    The UNIVERSITY ofNORTH CAROLINA atCHAPEL HILL

    Realistic SizesImagine 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

  • 8/8/2019 03 Dram

    19/56

    The UNIVERSITY ofNORTH CAROLINA atCHAPEL HILL

    SRAM PerformanceCurrent ones have cycle times inlow nanoseconds (say 2.5ns)

    Used as cache (typically offchipsecondary cache)

    Sizes up to 8Mbit or so for fast

    chips

  • 8/8/2019 03 Dram

    20/56

    The UNIVERSITY ofNORTH CAROLINA atCHAPEL HILL

    Using SRAM on Spartan IIRecall block SRAM available onchip

    11 4Kb blocks

    Configured in many ways (table)

  • 8/8/2019 03 Dram

    21/56

    The UNIVERSITY ofNORTH CAROLINA atCHAPEL HILL

    Using from VerilogInstantiate a block (here called R1)

    RAMB4_S8_S8 R1 (.DOA (data_a),

    .DOB (data_b),

    .ADDRA (addr_a),

    .ADDRB (addr_a),

    .CLKA (clk),

    .CLKB (clk),

    .DIA (data_in),

    .DIB (data_in),

    .ENA (ena),

    .ENB (enb),

    .RSTA (rsta),

    .RSTB (rstb),

    .WEA (wea),

    .WEB (web));

  • 8/8/2019 03 Dram

    22/56

    The UNIVERSITY ofNORTH CAROLINA atCHAPEL HILL

    Can InitializeHave to do it two ways, one forsimulator, another for hardware

    //synthesis attribute INIT_00 of R1 is"08192A3B4C5... total of 256 bits (64 hexcharacters)..."

    //synthesis attribute INIT_01 of R1 is"08192A3B4C5D6E7F08192A3B4C5D6E7F08192A3B4C5D6E7F0

    8192A3B4C5D6E7F

    // Up to INIT_0F

    Above is for hardware (nextsoftware)

  • 8/8/2019 03 Dram

    23/56

  • 8/8/2019 03 Dram

    24/56

    The UNIVERSITY ofNORTH CAROLINA atCHAPEL HILL

    Look atT

    est CodeMy RAM loading example fromundergrad class

    http://www.cs.unc.edu/~lastra/comp190/Assignments/block_ram_C.txt

  • 8/8/2019 03 Dram

    25/56

    The UNIVERSITY ofNORTH CAROLINA atCHAPEL HILL

    Dynamic RAMCapacitor can hold charge

    Transistor acts as gate

    No charge is a 0

    Can add charge to store a 1

    Then open switch (disconnect)

    Can read by closing switchExplanation next

  • 8/8/2019 03 Dram

    26/56

    The UNIVERSITY ofNORTH CAROLINA atCHAPEL HILL

    Prech

    arge and Sense AmpsYoull see precharge time

    B is precharged to V

    Charge/no-charge on C willincrease or decrease voltage

    Sense amps detect this

  • 8/8/2019 03 Dram

    27/56

    The UNIVERSITY ofNORTH CAROLINA atCHAPEL HILL

    DRAM Ch

    aracteristicsDestructive ReadWhen cell read, charge removed

    Must be restored after a read

    RefreshAlso, theres steady leakage

    Charge must be restored periodically

  • 8/8/2019 03 Dram

    28/56

    The UNIVERSITY ofNORTH CAROLINA atCHAPEL HILL

    DRAM Logical Diagram

  • 8/8/2019 03 Dram

    29/56

  • 8/8/2019 03 Dram

    30/56

    The UNIVERSITY ofNORTH CAROLINA atCHAPEL HILL

    DRAMW

    riteT

    iming

  • 8/8/2019 03 Dram

    31/56

    The UNIVERSITY ofNORTH CAROLINA atCHAPEL HILL

    DRAM Refresh

    Many strategies w/ logic on chip

    Here a row counter

  • 8/8/2019 03 Dram

    32/56

    The UNIVERSITY ofNORTH CAROLINA atCHAPEL HILL

    CAS Before RASSet column address

    Apply CAS first (opposite of RW)

    Then toggle RAS enough times tocycle through row addresses

    On-board refresh counter applies

    the row addresses

  • 8/8/2019 03 Dram

    33/56

    The UNIVERSITY ofNORTH CAROLINA atCHAPEL HILL

    TimingSay need to refresh every 64ms

    Distributed refresh

    Spread refresh out evenly over 64msSay on a 4Mx4 DRAM, refresh every64ms/4096=15.6us

    Total time spent is 0.25ms, but spread

    Burst refreshSame 0.25ms, but all at once

    May not be good in a computer system

    Refresh takes 1 % or so of total time

  • 8/8/2019 03 Dram

    34/56

    The UNIVERSITY ofNORTH CAROLINA atCHAPEL HILL

    Larger/W

    ider Memories

  • 8/8/2019 03 Dram

    35/56

    The UNIVERSITY ofNORTH CAROLINA atCHAPEL HILL

    Bidirectional LinesOne set of data pins

    Used as input for write

    As output for read

    Tri-state

    Makes sense because dont needboth at once

  • 8/8/2019 03 Dram

    36/56

  • 8/8/2019 03 Dram

    37/56

    The UNIVERSITY ofNORTH CAROLINA atCHAPEL HILL

    Synchronous DRAM (SDRAM)

    Common type in PCs late-90s

    Burst transfers

    Multiple banks

    PipelinedStart read in one bank after another

    Come back and read the resulting valuesone after another

  • 8/8/2019 03 Dram

    38/56

    The UNIVERSITY ofNORTH CAROLINA atCHAPEL HILL

    SDRAM on Xess BoardRelatively small at 128Mbits

    2M X 4 banks X 16 bits

    Refresh every 64ms

    Supports pipelining

    Bidirectional data lines

    Detailed info in a few slides

  • 8/8/2019 03 Dram

    39/56

    The UNIVERSITY ofNORTH CAROLINA atCHAPEL HILL

    DDR DRAMDouble Data Rate SDRAM

    Transfers data on both edges of

    the clock

    Currently popular

  • 8/8/2019 03 Dram

    40/56

    The UNIVERSITY ofNORTH CAROLINA atCHAPEL HILL

    RAMBUS DRAM (RDRAM)

    Another attempt to alleviatepinout limits

    Many (16-32) banks per chip

    Made to be read/written inpackets

    Up to 400MHz bus speedsBut DDR doing very well also

  • 8/8/2019 03 Dram

    41/56

    The UNIVERSITY ofNORTH CAROLINA atCHAPEL HILL

    DRAM Controllers

    Very common to have circuit thatcontrols memory

    Handles banksHandles refresh

    Multiplexes column and row

    addressesRAS and CAS timing

    Northbridge on PC chip set

  • 8/8/2019 03 Dram

    42/56

    The UNIVERSITY ofNORTH CAROLINA atCHAPEL HILL

    Next: Specifics on Our Chip

    Protocol for reading/writingActivate row first

    Then read/write with column

    Initialization

    Setting parameters

  • 8/8/2019 03 Dram

    43/56

    The UNIVERSITY ofNORTH CAROLINA atCHAPEL HILL

    Block Diagram

  • 8/8/2019 03 Dram

    44/56

    The UNIVERSITY ofNORTH CAROLINA atCHAPEL HILL

    Activate Row

  • 8/8/2019 03 Dram

    45/56

  • 8/8/2019 03 Dram

    46/56

    The UNIVERSITY ofNORTH CAROLINA atCHAPEL HILL

    Burst Reads

  • 8/8/2019 03 Dram

    47/56

    The UNIVERSITY ofNORTH CAROLINA atCHAPEL HILL

    Read with Autoprecharge

  • 8/8/2019 03 Dram

    48/56

    The UNIVERSITY ofNORTH CAROLINA atCHAPEL HILL

    Read w/o Autoprecharge

  • 8/8/2019 03 Dram

    49/56

    The UNIVERSITY ofNORTH CAROLINA atCHAPEL HILL

    Random Reads

  • 8/8/2019 03 Dram

    50/56

    The UNIVERSITY ofNORTH CAROLINA atCHAPEL HILL

    Alternating Banks

  • 8/8/2019 03 Dram

    51/56

    The UNIVERSITY ofNORTH CAROLINA atCHAPEL HILL

    SingleWrite

  • 8/8/2019 03 Dram

    52/56

    The UNIVERSITY ofNORTH CAROLINA atCHAPEL HILL

    Initializing

    See P.9 of Micron datasheet

    Just NOP commands for 100 us

    Precharge all banks

    Two Auto Refresh commands

    Then load mode register

  • 8/8/2019 03 Dram

    53/56

    The UNIVERSITY ofNORTH CAROLINA atCHAPEL HILL

    Mode Register

    Several operating modes ofSDRAM

    Burst or single

    0

    2 or 3 Order or

    accesses

    1,2,4,8 or

    full page

  • 8/8/2019 03 Dram

    54/56

    The UNIVERSITY ofNORTH CAROLINA atCHAPEL HILL

    DRAM Links

    DRAM on XSA-100 boardhttp://www.hynix.co.kr/datasheet/pdf/dram/(2)HY57V281620A(L)T-I.PDF

    Low-Tech RAM descriptionhttp://www.arstechnica.com/paedia/r/ram_guide/ram_guide.part1-1.html

    Datasheetshttp://www.hynix.co.kr/datasheet/pdf/dram/(2)HY57V281620A(L)T-I.PDF

    http://download.micron.com/pdf/datasheets/dram/128msdram_f.pdf

    http://www.infineon.com/cmc_upload/documents/018/329/hb39s128CT.pdf

    Verilog modelhttp://download.micron.com/downloads/models/verilog/sdram/sdr/128meg/

    mt48lc8m16a2.zip

  • 8/8/2019 03 Dram

    55/56

    The UNIVERSITY ofNORTH CAROLINA atCHAPEL HILL

    Assignment

    Try Block RAMMaybe to scan small stamps

    Or as character/sprite device

    Make DRAM controller to refreshscreen

    Deadline end of next week

  • 8/8/2019 03 Dram

    56/56

    Next Time

    Thursday 9/11 read Kurt Akeley,"Reality Engine Graphics",

    SIGGRAPH 93Link is

    http://doi.acm.org/10.1145/166117.166131