SLIDE 1 Which of the transistors below are on?
Submit your answer on menti.com with code 24 34 75
5V 6V 2V 4V 5V 9kΩ 1kΩ 9kΩ 1kΩ
A B C D
SLIDE 2
ENGR 40M, Lecture 10:
From logic gates to computers
Steven Bell
17 July 2016
SLIDE 3
Two levels of thinking about transistors
Logic-level Voltage/circuit level
An NMOS turns on when VGS > Vth A PMOS turns on when VGS < -Vth Transistor only "knows" voltages across its pins. Assume: NMOS source → Vdd, PMOS source → Gnd Assume: Inputs are HIGH (1, Vdd) or LOW (0, Gnd) Then: An NMOS turns on when input is high A PMOS turns on when input is low
SLIDE 4
Time taken on homework:
<= 1 hour <= 2 hours > 3 hours <= 3
SLIDE 5
By the end of today, you should be able to: Represent numbers using binary, with 2's complement for negative values Explain the various datatypes in Arduino, and predict overflow/underflow Take a keyboard apart (and figure out how it works).
SLIDE 6
Binary numbers
SLIDE 7
Convert the following decimal numbers to binary:
4, 19, 63, 256
Convert the following binary numbers to decimal:
10001, 10101, 00111, 11111111
SLIDE 8 0000 0011 0001 0010 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
binary integer
SLIDE 9
To write a negative number in 2's complement: Write the positive number in binary Flip all the bits (1→0, 0→1) Add 1 (with all the appropriate carries) To convert negative 2's complement to decimal, Flip all the bits (1→0, 0→1) Add 1 (with all the appropriate carries) Write the number in decimal
SLIDE 10 0000 0011 0001 0010 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7
binary unsigned signed signed overflow unsigned overflow
SLIDE 11 Convert the following decimal numbers to binary, using 8-bit 2's complement:
Convert the following 8-bit 2's complement binary numbers to decimal:
1000_0011, 0000_1011, 1111_1100
SLIDE 12
What is the largest signed number you can represent? Smallest (most negative) signed number?
If you have 8 bits:
SLIDE 13
Casting from one data type to another doesn't change the bits.
unsigned char x = 253; char y = x; print(y); char x = -1; int y = x; print(y);
When you add more bits, the number shouldn't change...
SLIDE 14
Building an adder
SLIDE 16
Breaking break:
Keyboards!