Midterm Flashcards

1
Q

How do you objectively campare the complexity of two circuits

A

number of gates. max propogation delay, number of transistors

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

JSR - 6502

A

jump to sub routine, push the address of the next op on to the stack

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

TSX - 6502

A

transfer stack pointer to x.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

minumum # of basic logic gates for a half adder

A

2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

minimmum # of basic logic gates for a full adder

A

5

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Universal set

A

express any boolean function using only the gates in S

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Name the universal sets

A

AND,OR,NOT NAND NOR AND, NOT

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

SCRAM lacked circuitry for what commands?

A

JMZ, ADD, SUB

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

the ones complement of signed integers has two zeros +0 and -0

A

true: 0000, 1111

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Ones compliment

A

obtained by inverting all bits in the binary number. negative if first digit is 1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

6502 BNE command

A

branches if zero flag is clear.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

6502 BCC

A

branches if carry flag clear

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

6502 BCS

A

branches if carry flag set

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

6502 BEQ

A

branches if zero flag set

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

6502 BMI

A

branch if negative flag set

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

6502 BPL

A

Branches if negativ eflag clear

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

6502 BVC

A

branch if overflow flag clear

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

6502 BVS

A

branch if overflow flag set

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

twos compliment of 5 bit range

A

-2^4 to 2^4 -1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

The encoding for all 6502 instructions is between 2 and 4 bytre long

A

false, sta $ffff is 5 bytes, ASL and TXA are 1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

of SCRAM machine instructions

A

16 - there are 16 pins

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

6502 CLC

A

clear carry flag

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

6502 CLD

A

clear decimal mode flag

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

6502 CLI

A

clear interrupt disable flag

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
6502 CLV
clear overflow flag
26
6502 SEC
set carry flag
27
6502 SED
set decimal mode flag
28
6502 SEI
set interrupt disable flag
29
6502 ASL
arithmetic shift left
30
6502 LSR
logical shift right
31
6502 ROL
rotate left
32
6502 ROR
rotate right
33
CPX, CPY, CMP 6502
compare x, compare y, compare accumulator \The compare instructions subtract (without carry) an immediate value or the contents of a memory location from the addressed register, but do not save the result in the register. The only indications of the results are the states of the three status flags: Negative (N), Zero (Z), and Carry (C). The combination of these three flags indicate whether the register contents are less than, equal to (the same as), or greater than the operand "data" (the immediate value or contents of the addressed memory location. The table below summarizes the result indicators for the compare instructions.
34
ADC/SBC 6502
Add/sub with carry
35
6502 PHA. PHP, PLA, PLP
Push accumulator on stack Push processor status on stack pull accumulator from stack pull processor status from stack
36
LDA, LDX, LDY
Load accumulator, load x, load y
37
add $a, $b, $c
a = b + c
38
addu $a, $b, $c
add unsigned
39
addi
adds constant
40
lw $t, C($s)
load word from MEM[$s + c] and following 3 bytes
41
lb $t, C($s)
loads byte from MEM[$s + c]
42
sw $t, C($s)
stores word into MEM[$s + c] and next 3 bits
43
sb $t, C($s)
stores the least-significant 8 bits of a register into MEM[$s +c]
44
and $d, $s, $t
bitwise $d = $s & $t
45
andi $t, $s, C
pads leftmost 16 bits with -s
46
beq $s,$t,C
jumps to c if equal
47
bne $s,$t,C
jumps if not equal
48
j C
jump to C
49
jr $s
go to address $s
50
jal
calls subrotine, jumps and links by copying program counter to $ra
51
MIPS add to stack
sub $sp, 4 sw $ra, ($sp)
52
MIPS subtract from stack
lw $ra, 0($sp) add $sp, 4 jr $ra
53
twos complement range
-2^(N-1) to 2^(N-1) - 1
54
twos complement
invert digits and add 1
55
NAND - and gate
![](http://www.electrical4u.com/wp-content/uploads/2013/07/realization-of-AND-gate-from-NAND-gate.png)
56
NAND - OR gate
![](http://cdn.instructables.com/FCR/NBYP/H3Z3C8OW/FCRNBYPH3Z3C8OW.LARGE.jpg)
57
NAND - NOT Gate
![](http://cdn.instructables.com/FSD/3H1Z/H3Z3U9W7/FSD3H1ZH3Z3U9W7.LARGE.jpg)
58
NOR - AND gate
![](http://www.electrical4u.com/wp-content/uploads/2013/07/universal-nor-gate-2.gif)
59
NOR - or gate
![](http://www.ktclear.in/uploads/12(2)Minimization%20of%20Logic%20Function)
60
NOT From NOR gate
![](http://i.stack.imgur.com/enFnq.gif)
61
xor
![](http://anubnair.files.wordpress.com/2010/12/high-z_solution_02.png)
62
RS latch
![](http://i.stack.imgur.com/Zel68.png)
63
shift register
![](http://upload.wikimedia.org/wikipedia/commons/a/a1/4-Bit_SIPO_Shift_Register.png)
64
DNF
disjunctive normal form - zeros a'b' + ab
65
CNF
66
half adder
![](http://www.circuitstoday.com/wp-content/uploads/2012/03/half-adder-truth-table-schematic-realization.png)
67
full adder
![](http://electriciantraining.tpub.com/14185/img/14185_125_1.jpg)
68
D type RS Latch
![](http://faculty.kfupm.edu.sa/COE/ashraf/RichFilesTeaching/COE043_200/Chapter4_1_files/gated-d-type-latch.gif)
69
edge triggered, master slave flip flop
![](http://upload.wikimedia.org/wikipedia/en/thumb/5/52/Negative-edge_triggered_master_slave_D_flip-flop.svg/512px-Negative-edge_triggered_master_slave_D_flip-flop.svg.png)
70
Bits of memeory in SCRAM
16 8 bit memory slots = 128bits
71
Size of addresses for SCRAM
4 bit
72
OP Code size in SCRAM
4 bits
73
total SCRAM instruction size
op code + addr = 8 bit
74
sign and magnitude
first bit says +/-
75
5 steps to pipelining MPS
1. Fetch Instruction - read from memory 2. Instruction Decoding - read source registers 3. Execution- execute 4. Memory Access - read/write 5. Write Back- store
76
JMZ
jump in 6502 if AC is 0
77
issue with JMZ
no connection from IR to PC no way to tell if AC was 0
78
Edge-triggered D-type flip-flop
![](http://cpuville.com/images/register_4.jpg)
79
6502 interrupt
IRQ does the following: The CPU has a input labelled IRQ When the pin is pulled low/ has 0 applied to it - a signal is sent to the CPU. The CPU halts the current program and runs the Interrupt Service Routine. This specifically works by: finishing the current instruction pushing the PC to the stack (addr of the next instruction) Interrupt disable flag is set a 16 bit address is read from $FFFE-$FFFF and put into PC That is where the ISR lives and needs to be supplied. The interrupt service routine must retrieve a copy of the saved status register from where it was pushed onto the stack and check the status of the B flag in order to distinguish between an IRQ and a BRK.
80
Distincy boolean functions of n arguments
2^(2^n)
81
D-Type Master-Slave Edge-triggered flip flop description
D-Type Master-Slave Edge-triggered flip flop: Data is captured on rising edge and output changes state on falling edge of the clock. First D-latch is master, second D-latch is slave and gets inverted Clock input.When clock signal changes from 0 to 1, output of slave latch takes value of output of master latch, since by the time the slave is open, the master already has taken the input, and can't receive any more.
82
CNF
ANDS of Ors
83
84
DNF
OR of ANDS
85
AB + CD DNF OR CNF
DNF
86
(A+B)(C+D)
Conjunctive Normal Form
87
RS LATCH circuit with nands
![](https://cdn.sparkfun.com/assets/learn_tutorials/2/1/6/34-sr-latch-nand.png)
88
RS LATCH NOR Truth table
![](http://www.biomedcentral.com/content/figures/1752-0509-3-72-1-l.jpg)
89
RS LATCH with NORS circuit
![](https://cdn.sparkfun.com/assets/learn_tutorials/2/1/6/30-SR-flipflop-circuit.PNG)
90
RS Latch Nand truth table
![](http://www.codeproject.com/KB/openGL/CircuitEngine/06_SRLatch.jpg)
91
RS LATCH NAND - Invalid state
S=0 R=0
92
LATCHED STATE NAND RS LATCH
R,S both = 1
93
Avoid invalid state on RS latch
![](http://upload.wikimedia.org/wikipedia/commons/thumb/c/cb/D-type_Transparent_Latch_(NOR).svg/300px-D-type_Transparent_Latch_(NOR).svg.png) this not gate makes the inputs always compliments of eachother
94
D Latch
![](http://upload.wikimedia.org/wikipedia/commons/thumb/c/cb/D-type_Transparent_Latch_(NOR).svg/300px-D-type_Transparent_Latch_(NOR).svg.png) *Transparent latch* When enabled - whatever D is - Q is. When disabled it stores the last value
95
96
Edge Trigger
![](http://sub.allaboutcircuits.com/images/04190.png)
97
D flip flop
D type latch with an enable that is connected to a clock and an edge trigger ![](http://students.cs.byu.edu/~cs224ta/labs/L02-fsm/Images/MS%20Flip%20Flop.gif)
98
How a D-type master slave edge triggered flip flop works
Data is captured on rising edge and output changes state on falling edge of the clock. First D-latch is master, second D-latch is slave and gets inverted Clock input.When clock signal changes from 0 to 1, output of slave latch takes value of output of master latch, since by the time the slave is open, the master already has taken the input, and can't receive any more.
99
CAFE in binary CAFE in decimal CAFE in base 8
Binary: 1100 1010 1111 1110 Decimal: 5 1966 Octal: 14 5376
100
abs can be done without branches
true
101
describe pipeline proces`
1) fetch instruction IF = instruction fetch; assembler has turned pseudo instruction into actual cpu instruction 2) instruction decoding ID, understanding what instruction it is, what resources it needs, read some of the registers if needed - - only load and store access memory 3) execution, EX drop to ALU, etc 4) if instruction needs to access memory, memory access stage MEM 5) write back, take what instruction computed and store it in the right register WB
102
structural hazard
structural hazard: run out of hardware, e.g. can't do two additions at the same time. not a problem with mips. hardware
103
data hazards
occur when the pipeline changes the order of read/write accesses to operands so that the order differs from the order seen by sequentially executing instructions on the unpipelined machine.
104
Saving registers on interrupts.
## Footnote The interrupts essentially jump to to the ISR (interrupt service routine). This ISR can do anything - and the main program will have no idea. So, it is responsible for saving the registers so that the program can continue. Example situation - the keyboard is connected to IRQ and causes an interrupt whenever it is clicked to avoid polling. Say that the keyboard needs to use registers to store info about what keys are pressed. In this case - we do not want registers to be trashed and it is the calee's responsibility to handle this - so we preserve the registers. In fact, the interrupts cannot save to the stack to the best of my knowledge because the interrupt could be called due to a corrupted stack pointer. Therefore, the memory is preserved in statically allocated chunk of global memory.
105
two examples of data hazards.
Example: (1) - add $t0, $t1, $t2 (2) - add $t7, $t0, $t8 Instruction (2) needs value from (1). WB is when the result is available but at this point (2) is already at MEM, which is an issue because that means it used the old value at $t0. Can be avoided by forwarding: Result of $t0 is already available at EX stage. We can add a path for output of EX back into EX, which allows updated $t0 to be available for (2). Example: (1) - lw $t0, 16($t7) (2) - add $t1, $t0, $t9 Both instructions depend on $t0. (1) result is only available at MEM stage after (1) loaded from memory, so (2) can't execute. Can't do anything about it, so you're forced to stall and do nothhing in EX for one cycle
106
What architechture is MIPS
RICS - reduced instruction set computing
107
CISC
Complex Instruction Set Computing
108
6502 Specs
* 8 bit accumulator. 3 * 8 bit registers. * X,Y,P. * 16 bit addresses. * Memory: 64kb
109
Absolute Adressing 6502
An instruction has explicit address in memory Prefeced with $.
110
Absolute with X/Y Adressing
Access what is in the specified memory location + contents of X/Y $ffff, x or ,y
111
Zero PAge Adressing 6502
memory in first 256 bytes of memory where msb is 0. Does one lestt memory fetch during execution.
112
relative adressing 6502
\*+4, gives you an offset
113
indirect adressing 6502
JMP ($40,x) load byte indirectly from memory.
114
Indexed Indirect Addressing (only works with X)
Ultimately gives an array of pointers indexed by X. If X = 1, and LDA ($11, X) is called, then 1 is added to 11 (which gives 12) and we look at the addresses 12 and 13 together. If address 12 contained FE and address 13 contained CA, then we would then look at the contents of memory address CAFE.
115
Indirect Indexed Addressing (only works with Y)
With Y = 1, assume LDA ($10, Y) is called. We then look at the addresses 10 an 11 together. If address 10 contained 00 and address 11 contained C0, then we would then look at the contents of memory address C000 + Y, which is C001.
116
6502 endedness
6502 is littleendian which means right most bytes is the op code. Instruction is left most. Adress is stored in reverse order.
117
MIPS specs
32 registers. 32 bits each. 4gb of memory.
118
3 addre
119
$zero
always zero register
120
$at
asembler temporary
121
$v\*
function results
122
$a\*
function arguments
123
$t\*
temporaries
124
$s\*
saved temporaries
125
$sp
stack pointer
126
$ra
return address
127
128
Write through
update cache and ram. Bring into cache and RAM concurrently
129
Write Buffer
Queue of pending writes so you dont need to wait for RAM to finish, just add to buffer. Best for few writes among many reads.
130
Write Back
Only update cache. When you load other things after there are more misses -write it back once you miss. Requires a dirty bit, write back on eviction from cache
131
Write allocate
read block from memory then write. Painful if want to initialize all to 0, tons of reads tat we dont need to do. If there are lots of writes but almost n oreads.
132
No write allocate
just write to memory, not going to read at all. JUST write to RAM. Wait for read - only fill cache when there is a reade.
133
SCRAM memory width
8 bits
134
SCRAM adress size. Instruction size
4 bits each
135
PC SCRAM
program counter. 4 bit register that holds current address
136
Accumulator SCRAM
8 bit register
137
CLU SCRAM
centeral logic unit, has all pins. controls flow.
138
MAR SCRAM
memory address register, Feeds into memory block
139
MBR Scram
memory address buffer- takes data from memory
140
SCRAM IR
holds op code and addr. Instruction Register.
141
6502 Endidness
Little Endian
142
Accumulator size 6502
8 bit
143
3 Registers 6502
A register (arithmatic) X register - index register only inc/dec Y register - same as X P register - status register, holds all flags. ALL 8 Bits
144
6502 memory size
64kb, 6 bit addr space 2^16 bytes.
145
6502 Compares
CMP, CMX, CMY setzero and carry flags
146
6502 branch instructions
if statements to jump BCC, BCS, BEQ, BNE
147
6502 increament/decrements instructions
incx, incy.
148
6502 shift/rotates
ASL,LSR ROR,ROL
149
6502 Jump Instructions
JMP - go to addr in memory JSR - jump to subroutine RTS - return from subroutine
150
Stack instructions 6502
PHP,PHA,TSX,TSX, PHA,PHP
151
6502 Absolute Addressing
Supplying instruction w/numberical addr: LDA $FE
152
6502 absolute x/y addressing
XY offsets access memory +x or y STA $0200,X
153
6502 Immediate Addressing
uses the value not the value at the address and #$1f
154
6502 zero page addressign
adresses that are only 8 bits 00-FF faster access
155
6502 indexed indirect addressing
works only with x register does address + x then loads two adjacent addresses
156
6502 indirect indexed addressing
gets two adresses adjacent. adds Y to that address.
157
158
MIPS internal improvements
higher clock speeds, pipelining
159
MIPS architechture bit
32
160
MIPS memory size
4GB
161
MIPS # registers/size of each
32 registers, 32-bits each
162
jump MIPS
j
163
How to do ifs with MIPS
slt - set if less than slt $t0, $t1, $t2 t2=1 or 0 branch seperate.
164
MIPS at
asssembler temporary
165
MIPS v0,v1
output/return values
166
MIPS a0-a3
inputs/parameters
167
MIPS t0-t7
temporaries
168
MIPS s0-s7
saved registers
169
MIPS sp
stack pointer
170
MIPS ra
return address
171
dynamic branch prediction simple
either taken or not taken gueses. Flaw: first last guess in loop will be wrong
172
dynamic branch prediction complex
taken, not taken taken maybe, not taken maybe if taken or taken maybe it will be taken again
173
memory heirarchy
register internal cache 2 level cahce tetriery cahce physical memory disk
174
block/line cache
min amount of info/memory in the cache or that can be brought into the cache
175
hit rate
fraction of memory accessess found in cche
176
miss rate
1 - hit rate
177
hit time
access time fro cache
178
miss penalty
time to get from RAM
179
direct mapping
one slot fo each tag
180
set associative
\>1 slot for each tag
181
Random evicion policies
good bottom line for comparison (not hardware)
182
FIFO
first in first out. throw out whats been there the longest. can implement in hardware.
183
LRU eviction policiess
least recently used. takes care of problem that FIFO could forget loop conter. Throws out what you have used the least often.
184
size of slot
log2(#sets)
185
size of offset
log2(block size)
186
tag
32 - slot - offset
187
x86 size of registers/number
8 32 bit registers
188
ESP
stck pointer
189
EBP
base pointer
190
size of addresses x86
32
191
[ebx] vs ebx
[ebx] address held in ebx so moving into [ebx] moves into the address held at ebx
192
x86 push
pushes stack by decrementing ESP by 4. Places operand into 32 bit location at ESP.
193
x86 Pop
removess 4 byte data from top of hardware stack. Moves 4 bytes into sp then into specified register. Increaments esp by 4.
194
195
6502 instruction size
1-3 bits
196
6502 address size
16
197