[CrashCourse CS] #6 Registers and RAM

Steve·2021년 4월 11일
0

To store a value and run several operations in a row, we use computer memory.

Making a memory by using loops

  • We can create circuits that loop back on themselves.
  • To permanently output value 1 : use OR.
  • To permanently output value 0 : use AND.
  • Combine them to make AND-OR Latch.
  • SET input : sets the output to a 1.
  • RESET input : sets the out to a 0.
  • If SET and RESET are both 0, the circuit outputs whatever was the last.
  • This is called a latch - it latches onto a perticular value and stays that way.
  • The action of putting data into memory is called writing, whereas getting the data out is called reading.

Gated Latch

  • Having two different wires for input - set and reset - is a bit confusing.
  • To make this a little easier to use, we ues a single wire to input data, and another wire that enable writing.
  • If we put 8 latches side-by-side, we can store 8 bits of information.
  • A group of latches operating like this is called a register, which holds a single number, and the number of bits in a register is called its width.
  • Early computers had 8 bit registers, then 16, 32, and nowadays have 64 bits wide registers.

8 bit register

  • Putting latches side-by-side takes too many wires for bigger registers.
  • Use matrix to save wires.

16 x 16 256 bit Latch Matrix

  • To eanble only a single latch, use AND gate to check if the row and the column wires are both 1.
  • Use a read wire to read the data later.


Memory address

  • To uniquely specify each intersection, we use memory address.

How to make a memory address

  • Making an adrress for row 12 column 8:
    • Since there is a maximum of 16 rows, we store the row address in a 4 bit number.
    • 12 - 1100, 8 - 1000
    • 11001000

Multiplexer

  • Multiplexer is a component that selects the latch via address.
  • Make row of 8 of them to store an 8 bit number (= byte).
  • To save an 8 bit number (1 0 0 1 0 1 0 1):
    • Save each bit into a same address for each 256bit block.
    • In total the component can store 256 8bit numbers ( = 256 bytes) at 256 different addresses.

  • The way that modern computers scale to megabytes and gigabytes of memory is to keep packaging up little bundles of memory into larger arrangements.
  • As the number of memory locations grow, addresses have to grow as well.
    • 8 bits hold enough numbers to provide addresses for 256 bytes of memory
    • To address a gigabyte (billion bytes) - we need 32 bit addreesses.

Random Access Memory

  • We can access any memory location at any time, and in a random order : Random-Access-Memory
    • Computer's memory = RAM
    • Similar to short-term memory for human
  • The RAM built here is a SRAM - Static Random-Access Memory (uses latches).
    • Other types : DRAM, Flash Memory, NVRAM...
    • Similar in function so SRAM, but use different circuits to store the individual bits.
  • Layers and layers of abstraction...!

Thoughts

  • 아빠가 하는 일이 저런거구나 싶었다.- "ASIC Programmer"
  • 메모리도 스위치의 조합으로 만들어진다는게 놀라웠다.
profile
게임과 프론트엔드에 관심이 많습니다.

0개의 댓글