computer science 101 computer systems organization machine language examples entire machine
TRANSCRIPT
Computer Science Computer Science 101101
Computer Systems Computer Systems OrganizationOrganization
Machine Language ExamplesMachine Language Examples
Entire machineEntire machine
Hypothetical Lab MachineHypothetical Lab Machine
Memory ALU Control
MAR(12) MDR(16)
16
ALU
R(16)
PC(12) IR(16)
+1
GT EQ LT
Hypothetical Machine Hypothetical Machine InstructionsInstructions
Opcode Operation MeaningOpcode Operation Meaning
00000000 Load X Con(X) Load X Con(X)RR
00010001 Store X R Store X RCon(X)Con(X)
00100010 Clear X Clear X 0 0Con(X)Con(X)
00110011 Add X R+Con(X) Add X R+Con(X)RR
01000100 Increment X Con(X)+1 Increment X Con(X)+1 Con(X)Con(X)
0101 Subtract X R-Con(X) 0101 Subtract X R-Con(X) RR
0110 Decrement X Con(X)-1 0110 Decrement X Con(X)-1 Con(X)Con(X)
Hypothetical Machine Hypothetical Machine InstructionsInstructions
Opcode Operation MeaningOpcode Operation Meaning
01110111 Compare X If Con(X) > R Compare X If Con(X) > R CC: 100,etc. CC: 100,etc.
10001000 Jump X Jump X X X PC PC
10011001 JumpGT X JumpGT X If GT=1, If GT=1, X X PC PC
10101010 JumpEQ X JumpEQ X If EQ=1, If EQ=1, X X PC PC
10111011 JumpLT X JumpLT X If LT=1, If LT=1, X X PC PC
11001100 JumpNE X JumpNE X If EQ=0, If EQ=0, X X PC PC
Hypothetical Machine Hypothetical Machine InstructionsInstructions
Opcode Operation MeaningOpcode Operation Meaning
11011101 In X In X Input value Input valueCon(X)Con(X)
11101110 Out X Out X Con(X) Con(X)Output Output valuevalue
11111111 Halt Halt Stop execution Stop execution
Machine Language: Machine Language: Con(5)+Con(6) Con(5)+Con(6) Con(7) Con(7)
0: 0000000000000101 1: 0011000000000110 2: 0001000000000111 3: 1111000000000000 4: 0000001000001010 5: 0000000000101100 6: 0000000000001011 7: 0000001111111111
R:
0000000000000101 Load 5
1111000011110000
0011000000000110 Add 60001000000000111 Store 71111000000000000 Halt
0000000000101100
0000000000101100
0000000000001011
0000000000110111
0000000000110111
Python: c = a + b
MicroMicro Steps: Fetch and Steps: Fetch and DecodeDecode
Phases PhasesFetch PhaseFetch Phase
PC PC MAR MAR
FetchFetch
MDR MDR IR IR
PC+1 PC+1 PC PC
DecodeDecode
IRIRopop ALU ALU
MUX MUX
Memory ALU Control
MAR(12) MDR(16)
16
ALU
R(16)
PC(12) IR(16)
+1
Micro Steps: Execution of LoadMicro Steps: Execution of Loadand Storeand Store
Load XLoad XIRIRaddadd MAR MAR
FetchFetch
MDR MDR R R
Store XStore XIRIRadd add MAR MAR
R R MDR MDR
StoreStore
Memory ALU Control
MAR(12) MDR(16)
16
ALU
R(16)
PC(12) IR(16)
+1
MicroMicro Steps: Execution of Steps: Execution of AddAddand Jumpand Jump
Add XAdd XIRIRaddadd MAR MAR
FetchFetch
MDR MDR ALU ALU
R R ALU ALU
AddAdd
ALU ALU R R
Jump XJump XIRIRadd add PC PC
Memory ALU Control
MAR(12) MDR(16)
16
ALU
R(16)
PC(12) IR(16)
+1
MicroMicro Steps: Execution of Steps: Execution of Compare and JumpGTCompare and JumpGT
Compare XCompare XIRIRaddadd MAR MAR
FetchFetch
MDR MDR ALU ALU
R R ALU ALU
SubtractSubtract (set CC) (set CC)
JumpGTJumpGTIf GT=1If GT=1
IR IRaddadd PC PC
Memory ALU Control
MAR(12) MDR(16)
16
ALU
R(16)
PC(12) IR(16)
+1