記憶體 Memory

tags: Technology

分類

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

  • Random Access Memory (RAM) - 當記憶體中的訊息被讀取或寫入時,所需要的時間與這段資訊所在的位置無關,也就是說可以不用按照位址的順序,而隨機指定記憶體位址來讀取或寫入資料。
    • DRAM
    • SRAM
  • Direct-access data storage - 讀寫記憶體的時間跟這Physical location有關係,所以讀寫速度會受到media rotation speed或arm movement限制
    • Hard disks
    • CD-RWs
    • DVD-RWs
    • Other older magnetic tapes and drum memory
  • 揮發性
    • Volatile: 電源關閉時,無法保存資料
      • DRAM
      • SRAM
    • Non-volatile: 電源關閉時,可以保存資料
      • ROM
      • Flash

DRAM(Dynamic RAM)

  • 利用電容來儲存資料的,也就是藉由判斷電容內的電量多寡來區別0和1,不過在現實中往往會發生漏電的現象,屬於揮發性記憶體(volatile memory)

  • 一旦時間久了,資料就有可能會消失,因此需要週期性的充電,此週期性充電又稱為重新整理(refresh),因此較為耗電。

  • 結構

    • 把一個 DRAM 晶片的內部結構剖開看看,會看到一個儲存陣列(Memorry Array)。CPU 會給這個儲存陣列「行地址」和「列地址」,就可以選出一個「儲存單元」。
      Image Not Showing Possible Reasons
      • The image file may be corrupted
      • The server hosting the image is unavailable
      • The image path is incorrect
      • The image format is not supported
      Learn More →
    • 每一個位元的資料通常都只需 一個電容跟一個電晶體 (1 Transistor 1 Capacitor, 1T1C) 來處理,電晶體在這裡的功用是用來控制讀取以及寫入,並不像其他種類的記憶體,是用來代表0與1的,在DRAM中,真正代表0與1的就是電容
    • 資訊存取時由字元線(Word Line, WL) 來控制電晶體開關,而位元線(Bit Line, BL) 則負責電荷的判讀和電容的充電。
    • 漏電 (leakage)
      Image Not Showing Possible Reasons
      • The image file may be corrupted
      • The server hosting the image is unavailable
      • The image path is incorrect
      • The image format is not supported
      Learn More →
      • 電容的電會從substrate漏掉導致電壓下降,因此需要定期refresh,根據JEDEC standard,每64ms要充電一次
        Image Not Showing Possible Reasons
        • The image file may be corrupted
        • The server hosting the image is unavailable
        • The image path is incorrect
        • The image format is not supported
        Learn More →
      • Refresh是一列一列(WL)refresh
  • 相比之下在SRAM上一個位元通常需要六個電晶體。正因這緣故,DRAM擁有非常高的密度,單位體積的容量較高因此成本較低

  • 缺點為存取速度較SRAM慢

  • Write speed = Read speed

  • CMOS晶片

    • 用於記錄主機板上面的重要參數的一塊可讀寫的RAM晶片
    • 電腦主板一般專門配有CMOS電池為其供電。
    • 主要包括系統時間、CPU電壓與頻率、各項設備的I/O位址與IRQ等
  • 由於主記憶體擺放在 CPU 之外,從工廠出來的晶粒需要封裝和組合之後才可和 CPU 連結,因此從 CPU 至 DRAM 晶粒之間依據層級由大至小為 channel>DIMM>rank>chip>bank>row/column

    • Image Not Showing Possible Reasons
      • The image file may be corrupted
      • The server hosting the image is unavailable
      • The image path is incorrect
      • The image format is not supported
      Learn More →
    • channel 和 DIMM
      • 每個 channel 需要配有 1 組記憶體控制器 (DRAMC)
      • 每個 channel 中能夠擁有許多組 DIMM(Dual In-line Memory Module),DIMM 也就是目前消費者能夠在市場上買到的記憶體模組
      • 早期發展出 SIMM(Single In-line Memory Module),將多組記憶體顆粒焊在 1 片電路板上,成為記憶體模組,再將此電路板插在主機板上。接著為了增加資料吞吐量,將 1 條記憶體模組的頻寬從 SIMM 的 32bit 改換成 DIMM 的 64bit
    • rank 和 chip
      Image Not Showing Possible Reasons
      • The image file may be corrupted
      • The server hosting the image is unavailable
      • The image path is incorrect
      • The image format is not supported
      Learn More →
    • bank、row、column
      Image Not Showing Possible Reasons
      • The image file may be corrupted
      • The server hosting the image is unavailable
      • The image path is incorrect
      • The image format is not supported
      Learn More →

      Image Not Showing Possible Reasons
      • The image file may be corrupted
      • The server hosting the image is unavailable
      • The image path is incorrect
      • The image format is not supported
      Learn More →
      • bank 再往下分拆就是實際儲存位元的電路,一般來說橫向選擇排數的線路稱為 row(row enable、row select、word line),直向負責傳遞訊號的線路為column(bitline)bank 再往下分拆就是實際儲存位元的電路,一般來說橫向選擇排數的線路稱為 row(row enable、row select、word line),直向負責傳遞訊號的線路為column(bitline)
  • 電腦常講的記憶體通常就是DRAM

    • 容量: 4GB、8GB、16GB、32GB
    • 世代
      Image Not Showing Possible Reasons
      • The image file may be corrupted
      • The server hosting the image is unavailable
      • The image path is incorrect
      • The image format is not supported
      Learn More →
      • JEDEC(Joint Electron Device Engineering Council): 記憶體標準的主體制定組織
      • DDR SDRAM (Double Data Rate SDRAM)
      • 目前較為常見的就是DDR3、DDR4,兩者插槽pin腳不一樣,因此購買時要看主機板是支援哪一種
      • DDR3
        • 電壓: 1.5V
        • DR3-1066, DDR3-1333, DDR3-1600, DDR3-1866, DDR3-2133
      • DDR4
        • 電壓: 1.2V (比DDR3更低)
        • DDR4-2133 (最低)、DDR4-2400, 2666, 2800, 2933, 3000, 3200
    • 尺寸
      • DIMM(Dual In Line Memory Module) :是一般桌電所使用的記憶體尺寸
      • SO-DIMM(Small Outline DIMM) :則是用於筆記型電腦的記憶體尺寸,它的尺寸比 DIMM 還要短很多。
        Image Not Showing Possible Reasons
        • The image file may be corrupted
        • The server hosting the image is unavailable
        • The image path is incorrect
        • The image format is not supported
        Learn More →
    • 頻率
      • DDR3-1600: 後面這個數字代表每秒的傳輸次數(megatransfers),單位是 MT/s,這個值大家也時常視為記憶體的時脈(clock rate),單位是 MHz,換算成傳輸速率就是 64 bits * 1600 MHz / 8 = 12800 MB/s。
    • 延遲時間(CAS latency,CL 值)
      • 電腦要讀取記憶體的資料時,需要等待多久之後才能真正開始讀取
      • 有些記憶體會標示它的延遲時間,其內容是一連串的數字,例如 9-10-9-27,第一個數字就是記憶體的延遲時間,單位是時脈週期。
      • 以DDR3-533為例,CL 值是7個時脈週期的話,換算出來就是 1/533000000 * 7 = 13.09 ns。
    • 主機板記憶體插槽
      • 通常這種很多記憶體插槽的主機板,它的記憶體插槽應該都會有不同的顏色,最簡單的做法就是選同一種顏色插,並且分散在不同的記憶體通道
        Image Not Showing Possible Reasons
        • The image file may be corrupted
        • The server hosting the image is unavailable
        • The image path is incorrect
        • The image format is not supported
        Learn More →
    • 通道
      • 有單通道、雙通道 (Dual-Channel)、三通道、多通道記憶體
      • 將多個記憶體由串聯方式改良為並聯方式,以得到更大的頻寬
        Image Not Showing Possible Reasons
        • The image file may be corrupted
        • The server hosting the image is unavailable
        • The image path is incorrect
        • The image format is not supported
        Learn More →
  • SDRAM (Synchronous DRAM)

SRAM(Static RAM,靜態隨機存取記憶體):

  • 使用 flip-flop 來儲存資料,只要保持通電,裡面儲存的資料就可以恆常保持,然而,當電力供應停止時,SRAM儲存的數據還是會消失(volatile memory)。
  • 需要六個電晶體(6T) 合起來才能保存一個 bit。
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →
  • 電晶體的開關速度遠比電容充電放電的速度還快,所以相對於 DRAM、SRAM 的讀寫速度比 DRAM 快很多。
  • Main Memory用DRAMCache用SRAM,因為SRAM價格較高,不易做成大容量,但他的速度較快, 因此整合到CPU內成為快取記憶體以加快資料的存取。

唯讀記憶體 ROM (Read Only Memory)

  • 非揮發性記憶體,在沒有通電時也能夠將資料記錄下來
  • BIOS(Basic Input Output System)
    • 一套程式,這套程式是寫死到主機板上面的一個記憶體晶片中,這個記憶體通常是ROM或Flash。
    • 他在開機的時候執行,以載入CMOS當中的參數,並嘗試呼叫儲存裝置中的開機程式,進一步進入作業系統當中。也可以修改CMOS中的資料。

Flash 快閃記憶體

  • 在電晶體中增加一層以多晶矽為材料的浮動閘極(Floating-Gate, FG),利用FG中有無電荷判別元件之記憶狀態
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →
  • 屬於非揮發性記憶體(NVM),FG被絕緣體夾住,當電源關掉時,FG中的電荷無法消散故能保存記憶。
  • Flash跟DRAM一樣有高密度優勢,而且還可以作多層次儲存(Multi-Level Cell, MLC),根據電荷多寡而不只是0和1,可以儲存2個以上的bits,因此記憶體容量可以達幾GB以上。
  • 電荷注入都需要經過絕緣層,所以資料存取會慢上許多。
  • 電荷經過絕緣層都會對絕緣層造成些許破壞,因此相較於DRAM、SRAM,Flash的壽命較短,只能存取幾千到幾萬次。
    • NOR Flash
      • 比 NAND Flash 更早導入市場。
      • 讀取的速度較快,但寫入的速度慢、價格也比 NAND Flash 貴。目前用來儲存作業系統的程式碼或重要資料,比如拿來做 ROM。
  • NAND Flash
    • 寫入的速度快、價格較低,故目前以 NAND Flash 最為普遍。
    • 應用: USB 硬碟、手機儲存空間、固態硬碟(Solid State Drive,SSD)

Reference