1. Combinational Elements
    1. clock 에 상관없이 오롯이 input 에 의존
  2. Sequential Elements
    1. The values of the outputs depend not only on the present values of the inputs but also on the past behavior of the circuit
      1. Such circuits include storage elements that store the values of logic signals
      2. The contents of the storage elements are said to represent the state of the circuit
    2. Register: stores data in a circuit
      1. Uses a clock signal to determine when to update the stored value
      2. Edge-triggered: update when Clk changes from 0 to 1
    3. Register with write control
      1. Only updates on clock edge when write control input is 1
      2. Used when stored value is required later
  3. Clocking Methodology
    1. Combinational logic transforms data during clock cycles
      1. between clock edges
      2. input from state elements, output to state element
      3. Longest delay determines clock period
    2. Typical execution:
      1. Read contents of state elements
      2. Send values through combinational logic
      3. Write results to one or more state elements
    3. An edge-triggered methodology allows us to read the contents of a register, send the value through some combinational logic, and write that register in the same clock cycles
  4. Building a Datapath
    1. Datapath
      1. Elements that process data and addresses in the CPU
        1. Registers, ALUs, mux’s, memories…
    2. We will build a RISC-V datapath incrementally
    3. Fetching Instructions
      1. Two state elements are needed to store and access instructions
        1. Instruction memory
        2. Program Counter(PC)
          1. The register containing the address of the instruction in the program being executed
          2. Incremented by 4 to prepare for executing the next instruction
    4. R-Format Instructions
      1. add, sub, and, or
      2. Register File
        1. A state element consisting of a set of registers
        2. The registers can be read and written by supplying a register number
      3. R-format instructions
        1. Three register operands
          1. Two data words read from the register file
          2. One data word written into the register file
        2. How many I/O needed?
        3. R-Format: ALU Operations
          1. Four inputs and two outputs
            1. To read a data: An input for the register number & an output for that will carry the value(which has been read)
            2. To write a data: two inputs(one to specify the register number and one to supply the data to be written)
          2. RegWrite: to control the write operation
          3. Bus size: how many bits?
            1. 레지스터 번호만 알면 되는 게 Read Register1, Read Register 2, Write Register 까지 해서 Input 3개니까, 5비트 * 3 = 15비트 에다가 Write Data 에는 진짜 그 값이 쓰여야 하니까, 32비트 . 또 read data 하려면 32비트씩 필요함.
      4. Load/Store Instructions
        1. General form:
          1. lw x1, offset_value(x2)
          2. sw x1, offset_value(x2)
        2. Load and store operations involves
          1. store value (read from the Register File during decode) written to the Data Memory
          2. load value, read from the Data Memory, written to the Register File