optional next presentations: execute last jlt opcode , clocks 109 to 117 or

Post on 09-Jan-2016

23 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

DESCRIPTION

Optional Next Presentations: Execute last JLT opcode , clocks 109 to 117 or Execute full program with separate control line and bus slides for each clock. End of Presentation. - PowerPoint PPT Presentation

TRANSCRIPT

1101010110101001011110000010111011111011101101101011000000101101111000100000000000000

011100010100000

1000000000

00100

01110

FETCH CIRCUITRY

INCREMENTOR

EXECUTE CIRCUITRY

ARITHMETIC &LOGIC UNIT

(ALU)

ADDRESS

DECODER

CLOCK

ACCUMULATOR

OPCODE OPERANDADDRESS

JUMPADDRESS

INSTRUCTION REGISTERS

PROGRAM COUNTER

LOAD PROGRAM INSTRUCTION COUNTER REGISTERS EXECUTE CONTROL

OPCODE IN

ACCUMULATORINSTRUCTION REGISTER CONTROL CONTROL ALU CONTROL MEM

OPCODE IN

LOADcentsJLTnickelDone:SUBnickelSTORcentsLOADcountINCSTORcountJMPAgain:HALT

1450

JMPAgain:

# copy the value at ‘cents’ to the Accumulator

# if the value at ‘nickel’ is less than the Accumulator then# jump to the address ‘Done:’

# subtract the value at ‘nickel’ from the Accumulator# and put the result back into the Accumulator# copy the value in the Accumulator to ‘cents’

# copy the value at address ‘count’ to the Accumulator

# add 1 to the Accumulator# copy the value in the Accumulator to ‘count’

# unconditional jump to the address ‘Again:’

# stop the processor – end of program

# variable -- the name ‘cents’ is the address and 14 is the value# variable -- the name ‘cents’ is the address and 5 is the value# variable -- the name ‘count’ is the address and 0 is the value

# unconditional jump to the address ‘Again:’

Assembly LanguageAddresses: Program: Explanation

Again:

Done:

centsnickelcount

000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F

Hex

000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F

Clock 19just

before start of

SUB

Fetch Circuitry

Opcode Register in bus enable

Operand Register in bus enable

Opcode Register Write

Program Counter Write

Increment Program Counter

Operand Register Write

Jump Register in bus enableJump Register Write

Control Lines OutData Bus to Fetch Circuitry Opcode In bus enable

Program Counter to Incrementor bus enable

Q

QSET

CLR

D

Clock in

Reset

Clock 1

Q

QSET

CLR

D

Clock 2

Q

QSET

CLR

D

Clock 3

Q

QSET

CLR

D

Clock 4

Q

QSET

CLR

D

Clock 5

Q

QSET

CLR

D

Clock 6

Program Counter to Address Bus enable

Detect HALT, INC, and NOT

Detect JMP

Detect all jumps (JMP, JEQ, JNE, JLT, JGE, JGT, JLE)

Fetch Opcode

Fetch Opcode

Increment Program Counter

Fetch Operand Address

Fetch Operand Address

Increment Program Counter

Increment Program Counter

Fetch Jump Address

Fetch Jump Address

Opcode In

If HALT, INC, and NOT, then reset the Ring Counter.

If not JEQ, JNE, JLT, JGE, JGT, or JLE then reset the Ring Counter.

If JMP then fetch the Jump Address otherwise fetch the Operand Addreass. Only JEQ, JNE, JLT,

JGE, JGT, or JLE will make it to here because of the resets at Clock 2 and Clock 4.

Execute out

J

Q

Q

K

SET

CLR

Clock pause during

execute

1

1

Fetch in (from

execute circuitry) Ring Counter

Decode to determine how many additional fetches are needed.

1101010110101001011110000010111011111011101101101011000000101101111000100000000000000

011100010100000

1000000000

00100

01110

FETCH CIRCUITRY

INCREMENTOR

EXECUTE CIRCUITRY

ARITHMETIC &LOGIC UNIT

(ALU)

ADDRESS

DECODER

CLOCK

ACCUMULATOR

OPCODE OPERANDADDRESS

JUMPADDRESS

INSTRUCTION REGISTERS

PROGRAM COUNTER

LOAD PROGRAM INSTRUCTION COUNTER REGISTERS EXECUTE CONTROL

OPCODE IN

ACCUMULATORINSTRUCTION REGISTER CONTROL CONTROL ALU CONTROL MEM

OPCODE IN

LOADcentsJLTnickelDone:SUBnickelSTORcentsLOADcountINCSTORcountJMPAgain:HALT

1450

JMPAgain:

# copy the value at ‘cents’ to the Accumulator

# if the value at ‘nickel’ is less than the Accumulator then# jump to the address ‘Done:’

# subtract the value at ‘nickel’ from the Accumulator# and put the result back into the Accumulator# copy the value in the Accumulator to ‘cents’

# copy the value at address ‘count’ to the Accumulator

# add 1 to the Accumulator# copy the value in the Accumulator to ‘count’

# unconditional jump to the address ‘Again:’

# stop the processor – end of program

# variable -- the name ‘cents’ is the address and 14 is the value# variable -- the name ‘cents’ is the address and 5 is the value# variable -- the name ‘count’ is the address and 0 is the value

# unconditional jump to the address ‘Again:’

Assembly LanguageAddresses: Program: Explanation

Again:

Done:

centsnickelcount

000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F

Hex

000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F

Clock 19Increment Program Counter(control)

Bus ControlI n p u t s F r o m B u s

AND AND AND AND AND

Control Line Input

O u t p u t

All output is 0 if Control Line is 0Identical to Inputs From Bus if Control Line is 1

0 0 1 0 0

1

00100

1 10 111 10 00

1101010110101001011110000010111011111011101101101011000000101101111000100000000000000

011100010100000

1000000000

00100

01110

FETCH CIRCUITRY

INCREMENTOR

EXECUTE CIRCUITRY

ARITHMETIC &LOGIC UNIT

(ALU)

ADDRESS

DECODER

CLOCK

ACCUMULATOR

OPCODE OPERANDADDRESS

JUMPADDRESS

INSTRUCTION REGISTERS

PROGRAM COUNTER

LOAD PROGRAM INSTRUCTION COUNTER REGISTERS EXECUTE CONTROL

OPCODE IN

ACCUMULATORINSTRUCTION REGISTER CONTROL CONTROL ALU CONTROL MEM

OPCODE IN

LOADcentsJLTnickelDone:SUBnickelSTORcentsLOADcountINCSTORcountJMPAgain:HALT

1450

JMPAgain:

# copy the value at ‘cents’ to the Accumulator

# if the value at ‘nickel’ is less than the Accumulator then# jump to the address ‘Done:’

# subtract the value at ‘nickel’ from the Accumulator# and put the result back into the Accumulator# copy the value in the Accumulator to ‘cents’

# copy the value at address ‘count’ to the Accumulator

# add 1 to the Accumulator# copy the value in the Accumulator to ‘count’

# unconditional jump to the address ‘Again:’

# stop the processor – end of program

# variable -- the name ‘cents’ is the address and 14 is the value# variable -- the name ‘cents’ is the address and 5 is the value# variable -- the name ‘count’ is the address and 0 is the value

# unconditional jump to the address ‘Again:’

Assembly LanguageAddresses: Program: Explanation

Again:

Done:

centsnickelcount

000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F

Hex

000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F

Clock 19Increment Program Counter(control)

Incrementor

O u t p u t Input number + 1

Carry out

0 0 1 0 00 0 0 0 1

0 0 1 0 0

4

Decimal equivalent

+ 1

0 0 1 0 1 5

+

0 0 1 0 1

0 1 000

0 000

Left bus into ALU

INC opcode

00100 + 00001 4 + 1

10

1101010110101001011110000010111011111011101101101011000000101101111000100000000000000

011100010100000

1000000000

00101

01110

FETCH CIRCUITRY

INCREMENTOR

EXECUTE CIRCUITRY

ARITHMETIC &LOGIC UNIT

(ALU)

ADDRESS

DECODER

CLOCK

ACCUMULATOR

OPCODE OPERANDADDRESS

JUMPADDRESS

INSTRUCTION REGISTERS

PROGRAM COUNTER

LOAD PROGRAM INSTRUCTION COUNTER REGISTERS EXECUTE CONTROL

OPCODE IN

ACCUMULATORINSTRUCTION REGISTER CONTROL CONTROL ALU CONTROL MEM

OPCODE IN

LOADcentsJLTnickelDone:SUBnickelSTORcentsLOADcountINCSTORcountJMPAgain:HALT

1450

JMPAgain:

# copy the value at ‘cents’ to the Accumulator

# if the value at ‘nickel’ is less than the Accumulator then# jump to the address ‘Done:’

# subtract the value at ‘nickel’ from the Accumulator# and put the result back into the Accumulator# copy the value in the Accumulator to ‘cents’

# copy the value at address ‘count’ to the Accumulator

# add 1 to the Accumulator# copy the value in the Accumulator to ‘count’

# unconditional jump to the address ‘Again:’

# stop the processor – end of program

# variable -- the name ‘cents’ is the address and 14 is the value# variable -- the name ‘cents’ is the address and 5 is the value# variable -- the name ‘count’ is the address and 0 is the value

# unconditional jump to the address ‘Again:’

Assembly LanguageAddresses: Program: Explanation

Again:

Done:

centsnickelcount

000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F

Hex

000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F

Clock 19Increment Program Counter(busses)

1101010110101001011110000010111011111011101101101011000000101101111000100000000000000

011100010100000

1000000000

00100

01110

FETCH CIRCUITRY

INCREMENTOR

EXECUTE CIRCUITRY

ARITHMETIC &LOGIC UNIT

(ALU)

ADDRESS

DECODER

CLOCK

ACCUMULATOR

OPCODE OPERANDADDRESS

JUMPADDRESS

INSTRUCTION REGISTERS

PROGRAM COUNTER

LOAD PROGRAM INSTRUCTION COUNTER REGISTERS EXECUTE CONTROL

OPCODE IN

ACCUMULATORINSTRUCTION REGISTER CONTROL CONTROL ALU CONTROL MEM

OPCODE IN

LOADcentsJLTnickelDone:SUBnickelSTORcentsLOADcountINCSTORcountJMPAgain:HALT

1450

JMPAgain:

# copy the value at ‘cents’ to the Accumulator

# if the value at ‘nickel’ is less than the Accumulator then# jump to the address ‘Done:’

# subtract the value at ‘nickel’ from the Accumulator# and put the result back into the Accumulator# copy the value in the Accumulator to ‘cents’

# copy the value at address ‘count’ to the Accumulator

# add 1 to the Accumulator# copy the value in the Accumulator to ‘count’

# unconditional jump to the address ‘Again:’

# stop the processor – end of program

# variable -- the name ‘cents’ is the address and 14 is the value# variable -- the name ‘cents’ is the address and 5 is the value# variable -- the name ‘count’ is the address and 0 is the value

# unconditional jump to the address ‘Again:’

Assembly LanguageAddresses: Program: Explanation

Again:

Done:

centsnickelcount

000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F

Hex

000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F

Clock 20

Fetch Circuitry

Opcode Register in bus enable

Operand Register in bus enable

Opcode Register Write

Program Counter Write

Increment Program Counter

Operand Register Write

Jump Register in bus enableJump Register Write

Control Lines OutData Bus to Fetch Circuitry Opcode In bus enable

Program Counter to Incrementor bus enable

Q

QSET

CLR

D

Clock in

Reset

Clock 1

Q

QSET

CLR

D

Clock 2

Q

QSET

CLR

D

Clock 3

Q

QSET

CLR

D

Clock 4

Q

QSET

CLR

D

Clock 5

Q

QSET

CLR

D

Clock 6

Program Counter to Address Bus enable

Detect HALT, INC, and NOT

Detect JMP

Detect all jumps (JMP, JEQ, JNE, JLT, JGE, JGT, JLE)

Fetch Opcode

Fetch Opcode

Increment Program Counter

Fetch Operand Address

Fetch Operand Address

Increment Program Counter

Increment Program Counter

Fetch Jump Address

Fetch Jump Address

Opcode In

If HALT, INC, and NOT, then reset the Ring Counter.

If not JEQ, JNE, JLT, JGE, JGT, or JLE then reset the Ring Counter.

If JMP then fetch the Jump Address otherwise fetch the Operand Addreass. Only JEQ, JNE, JLT,

JGE, JGT, or JLE will make it to here because of the resets at Clock 2 and Clock 4.

Execute out

J

Q

Q

K

SET

CLR

Clock pause during

execute

1

1

Fetch in (from

execute circuitry) Ring Counter

Decode to determine how many additional fetches are needed.

0

10

1101010110101001011110000010111011111011101101101011000000101101111000100000000000000

011100010100000

1000000000

00101

01110

FETCH CIRCUITRY

INCREMENTOR

EXECUTE CIRCUITRY

ARITHMETIC &LOGIC UNIT

(ALU)

ADDRESS

DECODER

CLOCK

ACCUMULATOR

OPCODE OPERANDADDRESS

JUMPADDRESS

INSTRUCTION REGISTERS

PROGRAM COUNTER

LOAD PROGRAM INSTRUCTION COUNTER REGISTERS EXECUTE CONTROL

OPCODE IN

ACCUMULATORINSTRUCTION REGISTER CONTROL CONTROL ALU CONTROL MEM

OPCODE IN

LOADcentsJLTnickelDone:SUBnickelSTORcentsLOADcountINCSTORcountJMPAgain:HALT

1450

JMPAgain:

# copy the value at ‘cents’ to the Accumulator

# if the value at ‘nickel’ is less than the Accumulator then# jump to the address ‘Done:’

# subtract the value at ‘nickel’ from the Accumulator# and put the result back into the Accumulator# copy the value in the Accumulator to ‘cents’

# copy the value at address ‘count’ to the Accumulator

# add 1 to the Accumulator# copy the value in the Accumulator to ‘count’

# unconditional jump to the address ‘Again:’

# stop the processor – end of program

# variable -- the name ‘cents’ is the address and 14 is the value# variable -- the name ‘cents’ is the address and 5 is the value# variable -- the name ‘count’ is the address and 0 is the value

# unconditional jump to the address ‘Again:’

Assembly LanguageAddresses: Program: Explanation

Again:

Done:

centsnickelcount

000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F

Hex

000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F

Clock 20Fetch 05

(control)

1101010110101001011110000010111011111011101101101011000000101101111000100000000000000

011100010100000

1000000000

00101

01110

FETCH CIRCUITRY

INCREMENTOR

EXECUTE CIRCUITRY

ARITHMETIC &LOGIC UNIT

(ALU)

ADDRESS

DECODER

CLOCK

ACCUMULATOR

OPCODE OPERANDADDRESS

JUMPADDRESS

INSTRUCTION REGISTERS

PROGRAM COUNTER

LOAD PROGRAM INSTRUCTION COUNTER REGISTERS EXECUTE CONTROL

OPCODE IN

ACCUMULATORINSTRUCTION REGISTER CONTROL CONTROL ALU CONTROL MEM

OPCODE IN

LOADcentsJLTnickelDone:SUBnickelSTORcentsLOADcountINCSTORcountJMPAgain:HALT

1450

JMPAgain:

# copy the value at ‘cents’ to the Accumulator

# if the value at ‘nickel’ is less than the Accumulator then# jump to the address ‘Done:’

# subtract the value at ‘nickel’ from the Accumulator# and put the result back into the Accumulator# copy the value in the Accumulator to ‘cents’

# copy the value at address ‘count’ to the Accumulator

# add 1 to the Accumulator# copy the value in the Accumulator to ‘count’

# unconditional jump to the address ‘Again:’

# stop the processor – end of program

# variable -- the name ‘cents’ is the address and 14 is the value# variable -- the name ‘cents’ is the address and 5 is the value# variable -- the name ‘count’ is the address and 0 is the value

# unconditional jump to the address ‘Again:’

Assembly LanguageAddresses: Program: Explanation

Again:

Done:

centsnickelcount

000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F

Hex

000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F

Clock 20Fetch 05

(busses)

Address DecoderI n p u t f r o m A d d r e s s B u s

000102

03040506

07

08090A

0B0C0D

0E0F1011

12

131415161718

191A1B1C

1D

1E1F

A d d r e s s B u s

0 0 1 0 1

1

1

1

01

1

0

1

11

11

1

01

11

11

1

1101010110101001011110000010111011111011101101101011000000101101111000100000000000000

011100010100000

1000000000

00101

01110 01011

FETCH CIRCUITRY

INCREMENTOR

EXECUTE CIRCUITRY

ARITHMETIC &LOGIC UNIT

(ALU)

ADDRESS

DECODER

CLOCK

ACCUMULATOR

OPCODE OPERANDADDRESS

JUMPADDRESS

INSTRUCTION REGISTERS

PROGRAM COUNTER

LOAD PROGRAM INSTRUCTION COUNTER REGISTERS EXECUTE CONTROL

OPCODE IN

ACCUMULATORINSTRUCTION REGISTER CONTROL CONTROL ALU CONTROL MEM

OPCODE IN

LOADcentsJLTnickelDone:SUBnickelSTORcentsLOADcountINCSTORcountJMPAgain:HALT

1450

JMPAgain:

# copy the value at ‘cents’ to the Accumulator

# if the value at ‘nickel’ is less than the Accumulator then# jump to the address ‘Done:’

# subtract the value at ‘nickel’ from the Accumulator# and put the result back into the Accumulator# copy the value in the Accumulator to ‘cents’

# copy the value at address ‘count’ to the Accumulator

# add 1 to the Accumulator# copy the value in the Accumulator to ‘count’

# unconditional jump to the address ‘Again:’

# stop the processor – end of program

# variable -- the name ‘cents’ is the address and 14 is the value# variable -- the name ‘cents’ is the address and 5 is the value# variable -- the name ‘count’ is the address and 0 is the value

# unconditional jump to the address ‘Again:’

Assembly LanguageAddresses: Program: Explanation

Again:

Done:

centsnickelcount

000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F

Hex

000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F

Clock 20Fetch 05

(busses)

1101010110101001011110000010111011111011101101101011000000101101111000100000000000000

011100010100000

1000000000

00100

01110

FETCH CIRCUITRY

INCREMENTOR

EXECUTE CIRCUITRY

ARITHMETIC &LOGIC UNIT

(ALU)

ADDRESS

DECODER

CLOCK

ACCUMULATOR

OPCODE OPERANDADDRESS

JUMPADDRESS

INSTRUCTION REGISTERS

PROGRAM COUNTER

LOAD PROGRAM INSTRUCTION COUNTER REGISTERS EXECUTE CONTROL

OPCODE IN

ACCUMULATORINSTRUCTION REGISTER CONTROL CONTROL ALU CONTROL MEM

OPCODE IN

LOADcentsJLTnickelDone:SUBnickelSTORcentsLOADcountINCSTORcountJMPAgain:HALT

1450

JMPAgain:

# copy the value at ‘cents’ to the Accumulator

# if the value at ‘nickel’ is less than the Accumulator then# jump to the address ‘Done:’

# subtract the value at ‘nickel’ from the Accumulator# and put the result back into the Accumulator# copy the value in the Accumulator to ‘cents’

# copy the value at address ‘count’ to the Accumulator

# add 1 to the Accumulator# copy the value in the Accumulator to ‘count’

# unconditional jump to the address ‘Again:’

# stop the processor – end of program

# variable -- the name ‘cents’ is the address and 14 is the value# variable -- the name ‘cents’ is the address and 5 is the value# variable -- the name ‘count’ is the address and 0 is the value

# unconditional jump to the address ‘Again:’

Assembly LanguageAddresses: Program: Explanation

Again:

Done:

centsnickelcount

000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F

Hex

000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F

Clock 21

Fetch Circuitry

Opcode Register in bus enable

Operand Register in bus enable

Opcode Register Write

Program Counter Write

Increment Program Counter

Operand Register Write

Jump Register in bus enableJump Register Write

Control Lines OutData Bus to Fetch Circuitry Opcode In bus enable

Program Counter to Incrementor bus enable

Q

QSET

CLR

D

Clock in

Reset

Clock 1

Q

QSET

CLR

D

Clock 2

Q

QSET

CLR

D

Clock 3

Q

QSET

CLR

D

Clock 4

Q

QSET

CLR

D

Clock 5

Q

QSET

CLR

D

Clock 6

Program Counter to Address Bus enable

Detect HALT, INC, and NOT

Detect JMP

Detect all jumps (JMP, JEQ, JNE, JLT, JGE, JGT, JLE)

Fetch Opcode

Fetch Opcode

Increment Program Counter

Fetch Operand Address

Fetch Operand Address

Increment Program Counter

Increment Program Counter

Fetch Jump Address

Fetch Jump Address

Opcode In

If HALT, INC, and NOT, then reset the Ring Counter.

If not JEQ, JNE, JLT, JGE, JGT, or JLE then reset the Ring Counter.

If JMP then fetch the Jump Address otherwise fetch the Operand Addreass. Only JEQ, JNE, JLT,

JGE, JGT, or JLE will make it to here because of the resets at Clock 2 and Clock 4.

Execute out

J

Q

Q

K

SET

CLR

Clock pause during

execute

1

1

Fetch in (from

execute circuitry) Ring Counter

Decode to determine how many additional fetches are needed.

1101010110101001011110000010111011111011101101101011000000101101111000100000000000000

011100010100000

1000000000

00101

01110 01011

FETCH CIRCUITRY

INCREMENTOR

EXECUTE CIRCUITRY

ARITHMETIC &LOGIC UNIT

(ALU)

ADDRESS

DECODER

CLOCK

ACCUMULATOR

OPCODE OPERANDADDRESS

JUMPADDRESS

INSTRUCTION REGISTERS

PROGRAM COUNTER

LOAD PROGRAM INSTRUCTION COUNTER REGISTERS EXECUTE CONTROL

OPCODE IN

ACCUMULATORINSTRUCTION REGISTER CONTROL CONTROL ALU CONTROL MEM

OPCODE IN

LOADcentsJLTnickelDone:SUBnickelSTORcentsLOADcountINCSTORcountJMPAgain:HALT

1450

JMPAgain:

# copy the value at ‘cents’ to the Accumulator

# if the value at ‘nickel’ is less than the Accumulator then# jump to the address ‘Done:’

# subtract the value at ‘nickel’ from the Accumulator# and put the result back into the Accumulator# copy the value in the Accumulator to ‘cents’

# copy the value at address ‘count’ to the Accumulator

# add 1 to the Accumulator# copy the value in the Accumulator to ‘count’

# unconditional jump to the address ‘Again:’

# stop the processor – end of program

# variable -- the name ‘cents’ is the address and 14 is the value# variable -- the name ‘cents’ is the address and 5 is the value# variable -- the name ‘count’ is the address and 0 is the value

# unconditional jump to the address ‘Again:’

Assembly LanguageAddresses: Program: Explanation

Again:

Done:

centsnickelcount

000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F

Hex

000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F

Clock 21Increment Program Counter(control)

Incrementor

O u t p u t Input number + 1

Carry out

0 0 1 0 10 0 0 0 0

0 0 1 0 1

5

Decimal equivalent

+ 1

0 0 1 1 0 6

+

0 0 1 1 0

0 1 100

0 100

Left bus into ALU

INC opcode

00101 + 00001 5 + 1

10

1101010110101001011110000010111011111011101101101011000000101101111000100000000000000

011100010100000

1000000000

00110

01110 01011

FETCH CIRCUITRY

INCREMENTOR

EXECUTE CIRCUITRY

ARITHMETIC &LOGIC UNIT

(ALU)

ADDRESS

DECODER

CLOCK

ACCUMULATOR

OPCODE OPERANDADDRESS

JUMPADDRESS

INSTRUCTION REGISTERS

PROGRAM COUNTER

LOAD PROGRAM INSTRUCTION COUNTER REGISTERS EXECUTE CONTROL

OPCODE IN

ACCUMULATORINSTRUCTION REGISTER CONTROL CONTROL ALU CONTROL MEM

OPCODE IN

LOADcentsJLTnickelDone:SUBnickelSTORcentsLOADcountINCSTORcountJMPAgain:HALT

1450

JMPAgain:

# copy the value at ‘cents’ to the Accumulator

# if the value at ‘nickel’ is less than the Accumulator then# jump to the address ‘Done:’

# subtract the value at ‘nickel’ from the Accumulator# and put the result back into the Accumulator# copy the value in the Accumulator to ‘cents’

# copy the value at address ‘count’ to the Accumulator

# add 1 to the Accumulator# copy the value in the Accumulator to ‘count’

# unconditional jump to the address ‘Again:’

# stop the processor – end of program

# variable -- the name ‘cents’ is the address and 14 is the value# variable -- the name ‘cents’ is the address and 5 is the value# variable -- the name ‘count’ is the address and 0 is the value

# unconditional jump to the address ‘Again:’

Assembly LanguageAddresses: Program: Explanation

Again:

Done:

centsnickelcount

000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F

Hex

000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F

Clock 21Increment Program Counter(busses)

1101010110101001011110000010111011111011101101101011000000101101111000100000000000000

011100010100000

1000000000

00110

01110 01011

FETCH CIRCUITRY

INCREMENTOR

EXECUTE CIRCUITRY

ARITHMETIC &LOGIC UNIT

(ALU)

ADDRESS

DECODER

CLOCK

ACCUMULATOR

OPCODE OPERANDADDRESS

JUMPADDRESS

INSTRUCTION REGISTERS

PROGRAM COUNTER

LOAD PROGRAM INSTRUCTION COUNTER REGISTERS EXECUTE CONTROL

OPCODE IN

ACCUMULATORINSTRUCTION REGISTER CONTROL CONTROL ALU CONTROL MEM

OPCODE IN

LOADcentsJLTnickelDone:SUBnickelSTORcentsLOADcountINCSTORcountJMPAgain:HALT

1450

JMPAgain:

# copy the value at ‘cents’ to the Accumulator

# if the value at ‘nickel’ is less than the Accumulator then# jump to the address ‘Done:’

# subtract the value at ‘nickel’ from the Accumulator# and put the result back into the Accumulator# copy the value in the Accumulator to ‘cents’

# copy the value at address ‘count’ to the Accumulator

# add 1 to the Accumulator# copy the value in the Accumulator to ‘count’

# unconditional jump to the address ‘Again:’

# stop the processor – end of program

# variable -- the name ‘cents’ is the address and 14 is the value# variable -- the name ‘cents’ is the address and 5 is the value# variable -- the name ‘count’ is the address and 0 is the value

# unconditional jump to the address ‘Again:’

Assembly LanguageAddresses: Program: Explanation

Again:

Done:

centsnickelcount

000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F

Hex

000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F

Clock 22

Fetch Circuitry

Opcode Register in bus enable

Operand Register in bus enable

Opcode Register Write

Program Counter Write

Increment Program Counter

Operand Register Write

Jump Register in bus enableJump Register Write

Control Lines OutData Bus to Fetch Circuitry Opcode In bus enable

Program Counter to Incrementor bus enable

Q

QSET

CLR

D

Clock in

Reset

Clock 1

Q

QSET

CLR

D

Clock 2

Q

QSET

CLR

D

Clock 3

Q

QSET

CLR

D

Clock 4

Q

QSET

CLR

D

Clock 5

Q

QSET

CLR

D

Clock 6

Program Counter to Address Bus enable

Detect HALT, INC, and NOT

Detect JMP

Detect all jumps (JMP, JEQ, JNE, JLT, JGE, JGT, JLE)

Fetch Opcode

Fetch Opcode

Increment Program Counter

Fetch Operand Address

Fetch Operand Address

Increment Program Counter

Increment Program Counter

Fetch Jump Address

Fetch Jump Address

Opcode In

If HALT, INC, and NOT, then reset the Ring Counter.

If not JEQ, JNE, JLT, JGE, JGT, or JLE then reset the Ring Counter.

If JMP then fetch the Jump Address otherwise fetch the Operand Addreass. Only JEQ, JNE, JLT,

JGE, JGT, or JLE will make it to here because of the resets at Clock 2 and Clock 4.

Execute out

J

Q

Q

K

SET

CLR

Clock pause during

execute

1

1

Fetch in (from

execute circuitry) Ring Counter

Decode to determine how many additional fetches are needed.

0 1 0

SUB opcode

0 1 0 1 1

1 1

11

10

001

0

1

10

1

1

1 00

0

0

0

0

0

0

0

00

1

1

0

1

1

1101010110101001011110000010111011111011101101101011000000101101111000100000000000000

011100010100000

1000000000

00110

01110 01011

FETCH CIRCUITRY

INCREMENTOR

EXECUTE CIRCUITRY

ARITHMETIC &LOGIC UNIT

(ALU)

ADDRESS

DECODER

CLOCK

ACCUMULATOR

OPCODE OPERANDADDRESS

JUMPADDRESS

INSTRUCTION REGISTERS

PROGRAM COUNTER

LOAD PROGRAM INSTRUCTION COUNTER REGISTERS EXECUTE CONTROL

OPCODE IN

ACCUMULATORINSTRUCTION REGISTER CONTROL CONTROL ALU CONTROL MEM

OPCODE IN

LOADcentsJLTnickelDone:SUBnickelSTORcentsLOADcountINCSTORcountJMPAgain:HALT

1450

JMPAgain:

# copy the value at ‘cents’ to the Accumulator

# if the value at ‘nickel’ is less than the Accumulator then# jump to the address ‘Done:’

# subtract the value at ‘nickel’ from the Accumulator# and put the result back into the Accumulator# copy the value in the Accumulator to ‘cents’

# copy the value at address ‘count’ to the Accumulator

# add 1 to the Accumulator# copy the value in the Accumulator to ‘count’

# unconditional jump to the address ‘Again:’

# stop the processor – end of program

# variable -- the name ‘cents’ is the address and 14 is the value# variable -- the name ‘cents’ is the address and 5 is the value# variable -- the name ‘count’ is the address and 0 is the value

# unconditional jump to the address ‘Again:’

Assembly LanguageAddresses: Program: Explanation

Again:

Done:

centsnickelcount

000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F

Hex

000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F

Clock 22Fetch 06

(control)

1101010110101001011110001010111011111011101101101011000000101101111000100000000000000

011100010100000

1000000000

00110

01110 01011 10111

FETCH CIRCUITRY

INCREMENTOR

EXECUTE CIRCUITRY

ARITHMETIC &LOGIC UNIT

(ALU)

ADDRESS

DECODER

CLOCK

ACCUMULATOR

OPCODE OPERANDADDRESS

JUMPADDRESS

INSTRUCTION REGISTERS

PROGRAM COUNTER

LOAD PROGRAM INSTRUCTION COUNTER REGISTERS EXECUTE CONTROL

OPCODE IN

ACCUMULATORINSTRUCTION REGISTER CONTROL CONTROL ALU CONTROL MEM

OPCODE IN

LOADcentsJLTnickelDone:SUBnickelSTORcentsLOADcountINCSTORcountJMPAgain:HALT

1450

JMPAgain:

# copy the value at ‘cents’ to the Accumulator

# if the value at ‘nickel’ is less than the Accumulator then# jump to the address ‘Done:’

# subtract the value at ‘nickel’ from the Accumulator# and put the result back into the Accumulator# copy the value in the Accumulator to ‘cents’

# copy the value at address ‘count’ to the Accumulator

# add 1 to the Accumulator# copy the value in the Accumulator to ‘count’

# unconditional jump to the address ‘Again:’

# stop the processor – end of program

# variable -- the name ‘cents’ is the address and 14 is the value# variable -- the name ‘cents’ is the address and 5 is the value# variable -- the name ‘count’ is the address and 0 is the value

# unconditional jump to the address ‘Again:’

Assembly LanguageAddresses: Program: Explanation

Again:

Done:

centsnickelcount

000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F

Hex

000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F

Clock 22Fetch 06

(busses)

Fetch Circuitry

Opcode Register in bus enable

Operand Register in bus enable

Opcode Register Write

Program Counter Write

Increment Program Counter

Operand Register Write

Jump Register in bus enableJump Register Write

Control Lines OutData Bus to Fetch Circuitry Opcode In bus enable

Program Counter to Incrementor bus enable

Q

QSET

CLR

D

Clock in

Reset

Clock 1

Q

QSET

CLR

D

Clock 2

Q

QSET

CLR

D

Clock 3

Q

QSET

CLR

D

Clock 4

Q

QSET

CLR

D

Clock 5

Q

QSET

CLR

D

Clock 6

Program Counter to Address Bus enable

Detect HALT, INC, and NOT

Detect JMP

Detect all jumps (JMP, JEQ, JNE, JLT, JGE, JGT, JLE)

Fetch Opcode

Fetch Opcode

Increment Program Counter

Fetch Operand Address

Fetch Operand Address

Increment Program Counter

Increment Program Counter

Fetch Jump Address

Fetch Jump Address

Opcode In

If HALT, INC, and NOT, then reset the Ring Counter.

If not JEQ, JNE, JLT, JGE, JGT, or JLE then reset the Ring Counter.

If JMP then fetch the Jump Address otherwise fetch the Operand Addreass. Only JEQ, JNE, JLT,

JGE, JGT, or JLE will make it to here because of the resets at Clock 2 and Clock 4.

Execute out

J

Q

Q

K

SET

CLR

Clock pause during

execute

1

1

Fetch in (from

execute circuitry) Ring Counter

Decode to determine how many additional fetches are needed.

0 1 0

SUB opcode

0 1 0 1 1

1 1

11

10

001

0

1

10

1

1

1 00

0

0

0

0

0

0

0

00

1

1

0

1

1

Reset

0 1

0

1101010110101001011110000010111011111011101101101011000000101101111000100000000000000

011100010100000

1000000000

00110

01110 01011

FETCH CIRCUITRY

INCREMENTOR

EXECUTE CIRCUITRY

ARITHMETIC &LOGIC UNIT

(ALU)

ADDRESS

DECODER

CLOCK

ACCUMULATOR

OPCODE OPERANDADDRESS

JUMPADDRESS

INSTRUCTION REGISTERS

PROGRAM COUNTER

LOAD PROGRAM INSTRUCTION COUNTER REGISTERS EXECUTE CONTROL

OPCODE IN

ACCUMULATORINSTRUCTION REGISTER CONTROL CONTROL ALU CONTROL MEM

OPCODE IN

LOADcentsJLTnickelDone:SUBnickelSTORcentsLOADcountINCSTORcountJMPAgain:HALT

1450

JMPAgain:

# copy the value at ‘cents’ to the Accumulator

# if the value at ‘nickel’ is less than the Accumulator then# jump to the address ‘Done:’

# subtract the value at ‘nickel’ from the Accumulator# and put the result back into the Accumulator# copy the value in the Accumulator to ‘cents’

# copy the value at address ‘count’ to the Accumulator

# add 1 to the Accumulator# copy the value in the Accumulator to ‘count’

# unconditional jump to the address ‘Again:’

# stop the processor – end of program

# variable -- the name ‘cents’ is the address and 14 is the value# variable -- the name ‘cents’ is the address and 5 is the value# variable -- the name ‘count’ is the address and 0 is the value

# unconditional jump to the address ‘Again:’

Assembly LanguageAddresses: Program: Explanation

Again:

Done:

centsnickelcount

000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F

Hex

000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F

Clock 23Transfer

to Execute

Execute Circuitry

HALT - disables clock input (not implemented)

INC

NOTANDOR

XOR

ADD

SUB

JEQ

JMP

JNEJLTJGEJGT

JLE

LOAD

STOROpcode Register out bus enableOperand Register out bus enableJump Address Register out bus enable

Memory Write

ALU ADD enableALU SUB enableALU INC enable

Accumulator out to ALU Left in enableAccumulator out to Data Bus enableAccumulator Write

Control Lines Out

Data Bus to ALU Right in enableData Bus to Accumulator in enable

Opc

ode

Regi

ster

out

bus

ena

ble

Ope

rand

Reg

iste

r out

bus

ena

ble

Mem

ory

Writ

e

ALU

AD

D e

nabl

eAL

U S

UB

enab

leAL

U IN

C en

able

Accu

mul

ator

out

to A

LU L

eft in

ena

ble

Accu

mul

ator

out

to D

ata

Bus

enab

leAc

cum

ulat

or W

rite

Dat

a Bu

s to

ALU

Rig

ht in

ena

ble

Dat

a Bu

s to

Acc

umul

ator

in e

nabl

e

ALU Jump Comparison

Logi

c op

code

s no

t im

plem

ente

d

Opcode bus in

Q

QSET

CLR

D

Clock in

Clock 1

Q

QSET

CLR

D

J

Q

Q

K

SET

CLR

1

1

Execute in (from fetch

circuitry)

Fetch out (to fetch circuitry)

Clock 2

Activate opcode

Decode and

execute opcode

Q

QSET

CLR

D

Clock 3

Third Clock for

AND, SUB, and INC

Reset after two clocks

Program Counter Write

Prog

ram

Cou

nter

Writ

e

Choose output for third clock

0

0

0

0

0

00

0

0

0

1

0

0

1101010110101001011110000010111011111011101101101011000000101101111000100000000000000

011100010100000

1000000000

00110

01110 01011 10111

FETCH CIRCUITRY

INCREMENTOR

EXECUTE CIRCUITRY

ARITHMETIC &LOGIC UNIT

(ALU)

ADDRESS

DECODER

CLOCK

ACCUMULATOR

OPCODE OPERANDADDRESS

JUMPADDRESS

INSTRUCTION REGISTERS

PROGRAM COUNTER

LOAD PROGRAM INSTRUCTION COUNTER REGISTERS EXECUTE CONTROL

OPCODE IN

ACCUMULATORINSTRUCTION REGISTER CONTROL CONTROL ALU CONTROL MEM

OPCODE IN

LOADcentsJLTnickelDone:SUBnickelSTORcentsLOADcountINCSTORcountJMPAgain:HALT

1450

JMPAgain:

# copy the value at ‘cents’ to the Accumulator

# if the value at ‘nickel’ is less than the Accumulator then# jump to the address ‘Done:’

# subtract the value at ‘nickel’ from the Accumulator# and put the result back into the Accumulator# copy the value in the Accumulator to ‘cents’

# copy the value at address ‘count’ to the Accumulator

# add 1 to the Accumulator# copy the value in the Accumulator to ‘count’

# unconditional jump to the address ‘Again:’

# stop the processor – end of program

# variable -- the name ‘cents’ is the address and 14 is the value# variable -- the name ‘cents’ is the address and 5 is the value# variable -- the name ‘count’ is the address and 0 is the value

# unconditional jump to the address ‘Again:’

Assembly LanguageAddresses: Program: Explanation

Again:

Done:

centsnickelcount

000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F

Hex

000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F

Clock 23Execute,activateopcode

(control)

1101010110101001011110000010111011111011101101101011000000101101111000100000000000000

011100010100000

1000000000

00110

01110 01011 10111

FETCH CIRCUITRY

INCREMENTOR

EXECUTE CIRCUITRY

ARITHMETIC &LOGIC UNIT

(ALU)

ADDRESS

DECODER

CLOCK

ACCUMULATOR

OPCODE OPERANDADDRESS

JUMPADDRESS

INSTRUCTION REGISTERS

PROGRAM COUNTER

LOAD PROGRAM INSTRUCTION COUNTER REGISTERS EXECUTE CONTROL

OPCODE IN

ACCUMULATORINSTRUCTION REGISTER CONTROL CONTROL ALU CONTROL MEM

OPCODE IN

LOADcentsJLTnickelDone:SUBnickelSTORcentsLOADcountINCSTORcountJMPAgain:HALT

1450

JMPAgain:

# copy the value at ‘cents’ to the Accumulator

# if the value at ‘nickel’ is less than the Accumulator then# jump to the address ‘Done:’

# subtract the value at ‘nickel’ from the Accumulator# and put the result back into the Accumulator# copy the value in the Accumulator to ‘cents’

# copy the value at address ‘count’ to the Accumulator

# add 1 to the Accumulator# copy the value in the Accumulator to ‘count’

# unconditional jump to the address ‘Again:’

# stop the processor – end of program

# variable -- the name ‘cents’ is the address and 14 is the value# variable -- the name ‘cents’ is the address and 5 is the value# variable -- the name ‘count’ is the address and 0 is the value

# unconditional jump to the address ‘Again:’

Assembly LanguageAddresses: Program: Explanation

Again:

Done:

centsnickelcount

000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F

Hex

000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F

Clock 23Execute,activateopcode(busses)

Execute Circuitry

HALT - disables clock input (not implemented)

INC

NOTANDOR

XOR

ADD

SUB

JEQ

JMP

JNEJLTJGEJGT

JLE

LOAD

STOROpcode Register out bus enableOperand Register out bus enableJump Address Register out bus enable

Memory Write

ALU ADD enableALU SUB enableALU INC enable

Accumulator out to ALU Left in enableAccumulator out to Data Bus enableAccumulator Write

Control Lines Out

Data Bus to ALU Right in enableData Bus to Accumulator in enable

Opc

ode

Regi

ster

out

bus

ena

ble

Ope

rand

Reg

iste

r out

bus

ena

ble

Mem

ory

Writ

e

ALU

AD

D e

nabl

eAL

U S

UB

enab

leAL

U IN

C en

able

Accu

mul

ator

out

to A

LU L

eft in

ena

ble

Accu

mul

ator

out

to D

ata

Bus

enab

leAc

cum

ulat

or W

rite

Dat

a Bu

s to

ALU

Rig

ht in

ena

ble

Dat

a Bu

s to

Acc

umul

ator

in e

nabl

e

ALU Jump Comparison

Logi

c op

code

s no

t im

plem

ente

d

Q

QSET

CLR

D

Clock in

Clock 1

Q

QSET

CLR

D

J

Q

Q

K

SET

CLR

1

1

Execute in (from fetch

circuitry)

Fetch out (to fetch circuitry)

Clock 2

Activate opcode

Decode and

execute opcode

Q

QSET

CLR

D

Clock 3

Third Clock for

AND, SUB, and INC

Reset after two clocks

Program Counter Write

Prog

ram

Cou

nter

Writ

e

Choose output for third clock

0

0

0

1

1

01

1

0

0

0

0

0

SUB opcode

0 1 0 1 1

Opcode bus in0 1 0 1 1

0

0 1

0

1

0 0

00

01 11

1

1

11

1 1

111

01

101

01

1

1

1

1101010110101001011110000010111011111011101101101011000000101101111000100000000000000

011100010100000

1000000000

00110

01110 01011 10111

FETCH CIRCUITRY

INCREMENTOR

EXECUTE CIRCUITRY

ARITHMETIC &LOGIC UNIT

(ALU)

ADDRESS

DECODER

CLOCK

ACCUMULATOR

OPCODE OPERANDADDRESS

JUMPADDRESS

INSTRUCTION REGISTERS

PROGRAM COUNTER

LOAD PROGRAM INSTRUCTION COUNTER REGISTERS EXECUTE CONTROL

OPCODE IN

ACCUMULATORINSTRUCTION REGISTER CONTROL CONTROL ALU CONTROL MEM

OPCODE IN

LOADcentsJLTnickelDone:SUBnickelSTORcentsLOADcountINCSTORcountJMPAgain:HALT

1450

JMPAgain:

# copy the value at ‘cents’ to the Accumulator

# if the value at ‘nickel’ is less than the Accumulator then# jump to the address ‘Done:’

# subtract the value at ‘nickel’ from the Accumulator# and put the result back into the Accumulator# copy the value in the Accumulator to ‘cents’

# copy the value at address ‘count’ to the Accumulator

# add 1 to the Accumulator# copy the value in the Accumulator to ‘count’

# unconditional jump to the address ‘Again:’

# stop the processor – end of program

# variable -- the name ‘cents’ is the address and 14 is the value# variable -- the name ‘cents’ is the address and 5 is the value# variable -- the name ‘count’ is the address and 0 is the value

# unconditional jump to the address ‘Again:’

Assembly LanguageAddresses: Program: Explanation

Again:

Done:

centsnickelcount

000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F

Hex

000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F

Clock 24Execute,

SUBNickel

(Part 1)(control)

1101010110101001011110000010111011111011101101101011000000101101111000100000000000000

011100010100000

1000000000

00110

01110 01011 10111

FETCH CIRCUITRY

INCREMENTOR

EXECUTE CIRCUITRY

ARITHMETIC &LOGIC UNIT

(ALU)

ADDRESS

DECODER

CLOCK

ACCUMULATOR

OPCODE OPERANDADDRESS

JUMPADDRESS

INSTRUCTION REGISTERS

PROGRAM COUNTER

LOAD PROGRAM INSTRUCTION COUNTER REGISTERS EXECUTE CONTROL

OPCODE IN

ACCUMULATORINSTRUCTION REGISTER CONTROL CONTROL ALU CONTROL MEM

OPCODE IN

LOADcentsJLTnickelDone:SUBnickelSTORcentsLOADcountINCSTORcountJMPAgain:HALT

1450

JMPAgain:

# copy the value at ‘cents’ to the Accumulator

# if the value at ‘nickel’ is less than the Accumulator then# jump to the address ‘Done:’

# subtract the value at ‘nickel’ from the Accumulator# and put the result back into the Accumulator# copy the value in the Accumulator to ‘cents’

# copy the value at address ‘count’ to the Accumulator

# add 1 to the Accumulator# copy the value in the Accumulator to ‘count’

# unconditional jump to the address ‘Again:’

# stop the processor – end of program

# variable -- the name ‘cents’ is the address and 14 is the value# variable -- the name ‘cents’ is the address and 5 is the value# variable -- the name ‘count’ is the address and 0 is the value

# unconditional jump to the address ‘Again:’

Assembly LanguageAddresses: Program: Explanation

Again:

Done:

centsnickelcount

000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F

Hex

000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F

Clock 24Execute,

SUBNickel

(Part 1)(busses)

14 - 5Enters the ALU

A L U(Arithmetic and Logic Unit)

Invertor

Five Bit Adder

Incrementor

Left bus into ALU

ALU Data Bus Out

SUBADD

Control Lines InINC

Right bus into ALU Jump Logic Arithmetic

Activate Five Bit Adder

Turn off left bus to Incrementor crossover

Turn on left bus to Incrementor crossover

SUB opcode

01110 – 0010114 - 5

01110 00101

01110

Less Than

Greater ThanLess Than or Equal

Not EqualEqual

Control Lines In

Greater Than or Equal

Equality

Inequality (Greater Than)

Right bus into ALU

Jump Decision Out

Left bus into ALU

00101

Invertor

O u t p u t

twos complement of the input bus

Bus input

1 1 1 1 1

0 1 0 10

0 0 1 0 1

1 0 1 01

A L U(Arithmetic and Logic Unit)

Invertor

Five Bit Adder

Incrementor

Left bus into ALU

ALU Data Bus Out

SUBADD

Control Lines InINC

Right bus into ALU Jump Logic Arithmetic

Activate Five Bit Adder

Turn off left bus to Incrementor crossover

Turn on left bus to Incrementor crossover

SUB opcode

01110 – 0010114 - 5

01110 00101

11010

11010

01110

Less Than

Greater ThanLess Than or Equal

Not EqualEqual

Control Lines In

Greater Than or Equal

Equality

Inequality (Greater Than)

Right bus into ALU

Jump Decision Out

Left bus into ALU

Incrementor

O u t p u t Input number + 1

Carry out

1 1 0 1 00 0 0 0 1

1 1 0 1 0

1 1 0 1 1

+

1 1 0 1 1

1 0 011

0 000

Left bus into ALU

INC opcode

11010 + 00001

10

A L U(Arithmetic and Logic Unit)

Invertor

Five Bit Adder

Incrementor

Left bus into ALU

ALU Data Bus Out

SUBADD

Control Lines InINC

Right bus into ALU Jump Logic Arithmetic

Activate Five Bit Adder

Turn off left bus to Incrementor crossover

Turn on left bus to Incrementor crossover

SUB opcode

01110 – 0010114 - 5

01110 00101

11010

11011

11010

11011

01110

Less Than

Greater ThanLess Than or Equal

Not EqualEqual

Control Lines In

Greater Than or Equal

Equality

Inequality (Greater Than)

Right bus into ALU

Jump Decision Out

Left bus into ALU

Five Bit Adder

O u t p u t

Accurate addition of two 5-bit binary numbers.

Carry out

0 1 1 1 01 1 0 1 1

0 1 1 1 0

1 1 0 1 1

1 4

Decimal equivalent

0 1 0 0 1 9

+

0 1 0 0 1

0 1 0

0

1

11

1

1

0

1

1

10

1 1 011

0

Left bus from ALU

Two’s Compiment from Right bus, after Invertor

and Incrementor

SUB opcode

01110 – 0010114 - 5

Carry is ignored in SUB

+ (-5)

A L U(Arithmetic and Logic Unit)

Invertor

Five Bit Adder

Incrementor

Left bus into ALU

ALU Data Bus Out

SUBADD

Control Lines InINC

Right bus into ALU Jump Logic Arithmetic

Activate Five Bit Adder

Turn off left bus to Incrementor crossover

Turn on left bus to Incrementor crossover

SUB opcode

01110 – 0010114 - 5

01110 00101

11010

11011

11010

11011

01110

01001

Less Than

Greater ThanLess Than or Equal

Not EqualEqual

Control Lines In

Greater Than or Equal

Equality

Inequality (Greater Than)

Right bus into ALU

Jump Decision Out

Left bus into ALU

1101010110101001011110000010111011111011101101101011000000101101111000100000000000000

011100010100000

1000000000

00110

01110 01011 10111

FETCH CIRCUITRY

INCREMENTOR

EXECUTE CIRCUITRY

ARITHMETIC &LOGIC UNIT

(ALU)

ADDRESS

DECODER

CLOCK

ACCUMULATOR

OPCODE OPERANDADDRESS

JUMPADDRESS

INSTRUCTION REGISTERS

PROGRAM COUNTER

LOAD PROGRAM INSTRUCTION COUNTER REGISTERS EXECUTE CONTROL

OPCODE IN

ACCUMULATORINSTRUCTION REGISTER CONTROL CONTROL ALU CONTROL MEM

OPCODE IN

LOADcentsJLTnickelDone:SUBnickelSTORcentsLOADcountINCSTORcountJMPAgain:HALT

1450

JMPAgain:

# copy the value at ‘cents’ to the Accumulator

# if the value at ‘nickel’ is less than the Accumulator then# jump to the address ‘Done:’

# subtract the value at ‘nickel’ from the Accumulator# and put the result back into the Accumulator# copy the value in the Accumulator to ‘cents’

# copy the value at address ‘count’ to the Accumulator

# add 1 to the Accumulator# copy the value in the Accumulator to ‘count’

# unconditional jump to the address ‘Again:’

# stop the processor – end of program

# variable -- the name ‘cents’ is the address and 14 is the value# variable -- the name ‘cents’ is the address and 5 is the value# variable -- the name ‘count’ is the address and 0 is the value

# unconditional jump to the address ‘Again:’

Assembly LanguageAddresses: Program: Explanation

Again:

Done:

centsnickelcount

000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F

Hex

000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F

Clock 25Execute,

SUBNickel

(Part 2)(busses)

14 - 5equals 9

Execute Circuitry

HALT - disables clock input (not implemented)

INC

NOTANDOR

XOR

ADD

SUB

JEQ

JMP

JNEJLTJGEJGT

JLE

LOAD

STOROpcode Register out bus enableOperand Register out bus enableJump Address Register out bus enable

Memory Write

ALU ADD enableALU SUB enableALU INC enable

Accumulator out to ALU Left in enableAccumulator out to Data Bus enableAccumulator Write

Control Lines Out

Data Bus to ALU Right in enableData Bus to Accumulator in enable

Opc

ode

Regi

ster

out

bus

ena

ble

Ope

rand

Reg

iste

r out

bus

ena

ble

Mem

ory

Writ

e

ALU

AD

D e

nabl

eAL

U S

UB

enab

leAL

U IN

C en

able

Accu

mul

ator

out

to A

LU L

eft in

ena

ble

Accu

mul

ator

out

to D

ata

Bus

enab

leAc

cum

ulat

or W

rite

Dat

a Bu

s to

ALU

Rig

ht in

ena

ble

Dat

a Bu

s to

Acc

umul

ator

in e

nabl

e

ALU Jump Comparison

Logi

c op

code

s no

t im

plem

ente

d

Q

QSET

CLR

D

Clock in

Clock 1

Q

QSET

CLR

D

J

Q

Q

K

SET

CLR

1

1

Execute in (from fetch

circuitry)

Fetch out (to fetch circuitry)

Clock 2

Activate opcode

Decode and

execute opcode

Q

QSET

CLR

D

Clock 3

Third Clock for

AND, SUB, and INC

Reset after two clocks

Program Counter Write

Prog

ram

Cou

nter

Writ

e

Choose output for third clock

0

0

0

1

1

11

1

0

0

0

0

0

SUB opcode

0 1 0 1 1

Opcode bus in0 1 0 1 1

0

0 1

0

1

0 0

00

01 11

1

1

11

1 1

111

11

101

01

1

1

1

1

1101010110101001011110000010111011111011101101101011000000101101111000100000000000000

011100010100000

1000000000

00110

01001 01011 10111

FETCH CIRCUITRY

INCREMENTOR

EXECUTE CIRCUITRY

ARITHMETIC &LOGIC UNIT

(ALU)

ADDRESS

DECODER

CLOCK

ACCUMULATOR

OPCODE OPERANDADDRESS

JUMPADDRESS

INSTRUCTION REGISTERS

PROGRAM COUNTER

LOAD PROGRAM INSTRUCTION COUNTER REGISTERS EXECUTE CONTROL

OPCODE IN

ACCUMULATORINSTRUCTION REGISTER CONTROL CONTROL ALU CONTROL MEM

OPCODE IN

LOADcentsJLTnickelDone:SUBnickelSTORcentsLOADcountINCSTORcountJMPAgain:HALT

1450

JMPAgain:

# copy the value at ‘cents’ to the Accumulator

# if the value at ‘nickel’ is less than the Accumulator then# jump to the address ‘Done:’

# subtract the value at ‘nickel’ from the Accumulator# and put the result back into the Accumulator# copy the value in the Accumulator to ‘cents’

# copy the value at address ‘count’ to the Accumulator

# add 1 to the Accumulator# copy the value in the Accumulator to ‘count’

# unconditional jump to the address ‘Again:’

# stop the processor – end of program

# variable -- the name ‘cents’ is the address and 14 is the value# variable -- the name ‘cents’ is the address and 5 is the value# variable -- the name ‘count’ is the address and 0 is the value

# unconditional jump to the address ‘Again:’

Assembly LanguageAddresses: Program: Explanation

Again:

Done:

centsnickelcount

000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F

Hex

000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F

Clock 25Execute,

SUBNickel

(Part 2)(busses)

14 - 5equals 9

Optional Next Presentations:

Execute last JLT opcode, clocks 109 to 117or

Execute full program with separate control line and bus slides for each clock

End of Presentation

top related