ENCE260 Flashcards
CPU to Internal peripherals
control bus, data bus (double)
CPU to memory
control bus, address bus, data bus (double)
CPU key functions
arithmetic,
evaluate logic expressions,
determine and control program flow
expression for number of combinations in a sequence
M^n
M = number of combinations
n = number of digits
Word length
default number of bits manipulated by microcontroller
ATMega32u2 is 8bit
Two’s compliment
swap the bits and add 1
1 more negative than positive
eg: 111 is -1,
000 is always 000.
Floating point
31st bit MSB
S-E8-F23
1 = -, 0 = +, same as two’s
write the number as binary, keeping the dot
E = Add 127 to amount you moved dot
F = fractional - 2nds, 4ths, 8ths, 16ths, etc
Combinational logic
output is a function of input only
Sequential logic
combinational logic with memory
SR latch
2 Nor gates
R sets one Q to on and one to off, which stays,
S switches it and stays
Issues - don’t know what initial state will be
##########
D flip flop
SR latch that works with a clock signal
basically just add an and for data and clock (to S)
and a not with the other and (for R)
Register
D flip flops that share a clock signal and output to a data bus
Data bus
width equal to CPU word length
transports data to and from CPU
Address bus
specifies memory locations
address space is 2^buswidth
controlled by CPU
16 bit in ATMega32u2
Control bus
sends commands to hardware from the CPU
Von-Neumann/Princeton architecture
all memory is stored in one place. Loses efficiency, as you can process only one thing at once instead of 2
Harvard architecture
instruction and data memory separate
canonical form logical functions
logic functions made of just the three fundamental functions:
AND, OR, NOT
algebraic properties: closure
if a,b elements of B, any function involving a and b will be an element of B
algebraic properties: identity
a.1 = a, a+0 = a
algebraic properties: annihilation
a.0 = 0, a+1 = 1
algebraic properties: absorption
a+(a.b) = a
a.(a+b) = a
algebraic properties: Idempotence
a+a = a, a.a = a
algebraic properties: or-compliment
a+!a = 1
algebraic properties: and compliment
a.!a = 0
algebraic properties: De Morgan’s
!(a+b) = !a.!b
!(a.b) = !a+!b
Make the 3 fundamental functions out of NAND gates
!a = !(a.a)
a.a = !(!(a.a).!(a.a))
a+b = !(!a.!b)
minterm
the output of karnaugh maps
and of either notted or not notted variables, must have each variable present. combine these by cancelling individual notted and not notted variables
Karnaugh maps
used for logic circuit design.
rectangles must be 2^n by 2^m
sum of products SOP
summation of the minterms of a truth table
General purpose registers
IO register for ALU - increases speed - 32 registers in ATMega32u2
special/control registers
stores special variables that control overall behaviour
PC
program counter, part of the special/control registers.
stores address of the next instruction in program memory, controls/sets program flow
SP
stack pointer, part of the special/control registers.
Control/execute unit
- fetches instructions from memory to the instruction register
- decodes opcode
- loads variables into GPR/SR and then controls loading them into the ALU.
- Instructs the ALU what operations to execute and when.
- stores output of the ALU into the correct GPR
Half adder
built from a left-right separation of a+b truth table
C - AND
S - XOR
full adder
two half adders combined.
The carry bits get ORed and outputted along with the sum. This makes the sum the 1’s column and the Carry the 2’s column
Decoder/Encoder
turns the bus’ n traces into 2^n outputs (decoder) and vice versa
works by breaking input into two traces, one with a not.
00 0001
01 0010
10 0100
11 1000
Priority encoder
only takes the highest 1 from the input
Multiplexer/demultiplexer
S chooses whether I0 or I1 is outputted (2:1 mux)
S needs to be sufficiently large to account for as many input options there are. generally 2^n = i
full adder subtraction
Goal is two’s compliment. Done by XOR with input line and a Sub line. The sub line goes in to the first carry to count as +1
You can use a truth table to confirm.
shift register
D flip-flops in series(Q -> D) with a common clock
Because change only occurs on the rising edge, the shift has to propagate through n rising edges before it stops