Shreyas’ Notes

Fundamentals of Computer Engineering

ELEC 220

spring, freshman year

Combine CS and EE to design and implement an optimized computing system.

control+datapath=processor\textrm{control} + \textrm{datapath} = \textrm{processor}

History §

Babbage §

Binary §

Unsigned binary integers §

x=xn12n1+xn22n2++x020x = x_{n - 1} 2^{n - 1} + x_{n - 2} 2^{n - 2} + \cdots + x_0 2^0

Range: 00 to 2n12^n - 1

2’s complement signed integers §

x=xn12n1+xn22n2++x020x = -x_{n - 1}2^{n - 1} + x_{n-2} 2^{n-2} + \cdots + x_0 2^0

MSB is the sign bit.

Range: 2n1-2^{n-1} to +2n11+2^{n-1} - 1

Overflow §

Sum requires more bits than the input data width.

LRL - R (+)(+) ()(-)
(+)(+) No Maybe
()(-) Maybe No
L+RL + R (+)(+) ()(-)
(+)(+) Maybe No
()(-) No Maybe

Sign extension §

move 2’s complement signed int from smaller to larger container: replicate the sign bit to the left

Floating Points §

IEEE 754-1985 standard.

Types:

Components:

x=(1)sign×(1+fraction)×2exponentbiasx = (-1)^{\mathrm{sign}} \times (1 + \mathrm{fraction}) \times 2^{\mathrm{exponent} - \mathrm{bias}}

special cases

Memory §

Byte ordering §

Example (0x07AB9DCE):

Address B.E. value L.E. value
0x70 07 CE
0x71 AB 9D
0x72 9D AB
0x73 CE 07

Addresses, data.

TM4C123GH6PM §

Memory:

C §

Pointers §

components:

  1. read operands only from the register file
  2. write operations only to the register file
  3. only one way to move data between the register file and data memory

Bitwise operators §

RISC V §

Reduced Instruction Set Computing.

RISC-V has 32 registers. x0 through x31. Have no type.

See https://en.wikipedia.org/wiki/RISC-V#Design

R-format — register-register arithmetic §

Operation OP Code funct7 funct3
ADD 0110011 0000000 000
SUB 0110011 0100000 000
SLL 0110011 0000000 001
SLT 0110011 0000000 010
SLTU 0110011 0000000 011
XOR 0110011 0000000 100
SRL 0110011 0000000 101
SRA 0110011 0100000 101
OR 0110011 0000000 110
AND 0110011 0000000 111

I-format — register-immediate arithmetic §

S-format — stores §

B-format — branches §

U-format — 20-bit upper immediate §

J-format — jumps §

Instructions §

Analog to Digital §

input: continous time signal

output: discrete sequence

Logic Design §

Demultiplexer

Multiplexer

Canonical forms:

Transistors:

Cache §

memory hierarchy.

trade-off between speed and price/size. small, fast vs large, slow.

locality:

types:

C=S×E×BC = S \times E \times B data bytes

Word length: t+s+bt + s + b