Computing Machinery Chapter 8: The Very Simple Computer
description
Transcript of Computing Machinery Chapter 8: The Very Simple Computer
![Page 1: Computing Machinery Chapter 8: The Very Simple Computer](https://reader034.fdocuments.net/reader034/viewer/2022051419/56815a65550346895dc7aee4/html5/thumbnails/1.jpg)
Computing MachineryChapter 8: The Very Simple Computer
![Page 2: Computing Machinery Chapter 8: The Very Simple Computer](https://reader034.fdocuments.net/reader034/viewer/2022051419/56815a65550346895dc7aee4/html5/thumbnails/2.jpg)
The concept of a stored program was part of the design of the Analytical Engine and well understood by Charles Babbage and Augusta Ada King more than 150 years ago.
For some reason, this concept was temporarily lost or forgotten by the middle of the 20th century.
Early electronic computers, such as the ENIAC, kept the logic and arithmetic instructions separate from the data. Some early computers had to be rewired in order to change their programs.
The interpretation of a word in memory as either an instruction or data is determined by its location in memory rather than its pattern of ones and zeros. The content of memory has more than one possible interpretation. For example, the bit pattern,
01000000110010010000111111011010
can represent the integer 1,086,918,618 or an instruction to JUMP to another location
(address) in memory, or it could represent an approximation for the numeric value of .
The Von-Neumann Architecture
![Page 3: Computing Machinery Chapter 8: The Very Simple Computer](https://reader034.fdocuments.net/reader034/viewer/2022051419/56815a65550346895dc7aee4/html5/thumbnails/3.jpg)
Designing the Very Simple Computer
VSC Instruction
operations code address
3-bits limits the number ofinstructions to 23 = 8
5-bit limits the number ofwords to 25 = 32
8-bit instructions will all be direct addressing mode
data type will be integer, twos'-complement
operations will correspond to Post-Turing language
with only 8 instructions, the VSC is the "Ultimate RISC" Computer
![Page 4: Computing Machinery Chapter 8: The Very Simple Computer](https://reader034.fdocuments.net/reader034/viewer/2022051419/56815a65550346895dc7aee4/html5/thumbnails/4.jpg)
The Very Simple Computer
![Page 5: Computing Machinery Chapter 8: The Very Simple Computer](https://reader034.fdocuments.net/reader034/viewer/2022051419/56815a65550346895dc7aee4/html5/thumbnails/5.jpg)
Program Counter (PC) - The address of the next instruction that is to be executed is held in a register called the program counter (PC). The value in this register is passed to the memory unit as the address of the instruction to access. During the fetch portion of the fetch-execute cycle, the value in the PC is incremented.
Program Counter (PC)
![Page 6: Computing Machinery Chapter 8: The Very Simple Computer](https://reader034.fdocuments.net/reader034/viewer/2022051419/56815a65550346895dc7aee4/html5/thumbnails/6.jpg)
Memory Address Register (MAR) - The memory address register (MAR) of the VSC memory is also a 5-bit register. To read or write a word, we first place the memory address into the MAR and then activate the appropriate control lines (Read/Write, and Memory Enable) to perform the indicated I/O operation.
Memory Address Register (MAR)
![Page 7: Computing Machinery Chapter 8: The Very Simple Computer](https://reader034.fdocuments.net/reader034/viewer/2022051419/56815a65550346895dc7aee4/html5/thumbnails/7.jpg)
Instruction Register (IR) - The VSC is a single-address instruction machine so the instruction register needs room to hold the operations code (op-code) of the instruction to be executed and the address on which the operation is performed. Since the VSC uses 8-bit words, the instruction register (IR) supports a 5-bit address and a 3-bit op-code.
Instruction Register (IR)
![Page 8: Computing Machinery Chapter 8: The Very Simple Computer](https://reader034.fdocuments.net/reader034/viewer/2022051419/56815a65550346895dc7aee4/html5/thumbnails/8.jpg)
ALU Latches (LAT1 and LAT2) - The arithmetic logic unit (ALU) accepts one or two input values. These values are held above the ALU in registers called Latch1 (LAT1) and Latch2 (LAT2). These registers have outputs that are always active since they are directly connected to the ALU and are never used to write to the bus.
Arithmetic Logic Unit (ALU) Latches
![Page 9: Computing Machinery Chapter 8: The Very Simple Computer](https://reader034.fdocuments.net/reader034/viewer/2022051419/56815a65550346895dc7aee4/html5/thumbnails/9.jpg)
Accumulator (ACC) - The output of the ALU is the result of the execution of some arithmetic or logical operation. This value is held in the accumulator (ACC) until it is moved or otherwise managed by a subsequent instruction. Since the VSC is a single-address instruction CPU, the value in the ACC is transferred to one of the ALU latches during the fetch.
Accumulator (ACC)
![Page 10: Computing Machinery Chapter 8: The Very Simple Computer](https://reader034.fdocuments.net/reader034/viewer/2022051419/56815a65550346895dc7aee4/html5/thumbnails/10.jpg)
The Instruction Set
LDA addr - load the accumulator with the value from memory at address addr
STA addr - store the value in the accumulator into memory at address addr.
ADD addr - add value in memory at address addr to ACC and store in LAT1.
CMP addr - take the 1's complement of the value in memory at address addr
BNN addr - the branch-not-negative statement will set PC = addr if the value in the accumulator is not negative.
SHL addr - shift value in memory at address addr one bit to the left.
SHR addr - shift value in memory at address addr one bit to the right (arithmetic).
HLT - this instruction terminates the fetch-execute cycle.
![Page 11: Computing Machinery Chapter 8: The Very Simple Computer](https://reader034.fdocuments.net/reader034/viewer/2022051419/56815a65550346895dc7aee4/html5/thumbnails/11.jpg)
Register Transfer Description
211111PCXHLT111
2divXMEMACCXSHR110
2XMEMACCXSHL101
XPCthen0ACCifXBNN100
XMEMACCXCMP011
ACCXMEMACCXADD010
ACCXMEMXSTO001
XMEMACCXLDA000
][
*][
)(
][
][
][
][
![Page 12: Computing Machinery Chapter 8: The Very Simple Computer](https://reader034.fdocuments.net/reader034/viewer/2022051419/56815a65550346895dc7aee4/html5/thumbnails/12.jpg)
The Fetch/Execute Cycle
enEXE
MARMEM1LAT
ACC2LAT
1PCPC
04IRMAR
MARMEMIR
PCMAR
][
:
][
get the address of the next instruction
load the instruction register with the next instruction
get the address in the current instruction
increment to program counter
move the value in the ALU ACC into LAT2
move the data referred to by the instruction into LAT1
execute the instruction
![Page 13: Computing Machinery Chapter 8: The Very Simple Computer](https://reader034.fdocuments.net/reader034/viewer/2022051419/56815a65550346895dc7aee4/html5/thumbnails/13.jpg)
Running the VSC
enEXE
MARMEM1LAT
ACC2LAT
1PCPC
04IRMAR
MARMEMIR
PCMAR
][
:
][
![Page 14: Computing Machinery Chapter 8: The Very Simple Computer](https://reader034.fdocuments.net/reader034/viewer/2022051419/56815a65550346895dc7aee4/html5/thumbnails/14.jpg)
Running the VSC
enEXE
MARMEM1LAT
ACC2LAT
1PCPC
04IRMAR
MARMEMIR
PCMAR
][
:
][
![Page 15: Computing Machinery Chapter 8: The Very Simple Computer](https://reader034.fdocuments.net/reader034/viewer/2022051419/56815a65550346895dc7aee4/html5/thumbnails/15.jpg)
Running the VSC
enEXE
MARMEM1LAT
ACC2LAT
1PCPC
04IRMAR
MARMEMIR
PCMAR
][
:
][
![Page 16: Computing Machinery Chapter 8: The Very Simple Computer](https://reader034.fdocuments.net/reader034/viewer/2022051419/56815a65550346895dc7aee4/html5/thumbnails/16.jpg)
Running the VSC
enEXE
MARMEM1LAT
ACC2LAT
1PCPC
04IRMAR
MARMEMIR
PCMAR
][
:
][
![Page 17: Computing Machinery Chapter 8: The Very Simple Computer](https://reader034.fdocuments.net/reader034/viewer/2022051419/56815a65550346895dc7aee4/html5/thumbnails/17.jpg)
Running the VSC
enEXE
MARMEM1LAT
ACC2LAT
1PCPC
04IRMAR
MARMEMIR
PCMAR
][
:
][
![Page 18: Computing Machinery Chapter 8: The Very Simple Computer](https://reader034.fdocuments.net/reader034/viewer/2022051419/56815a65550346895dc7aee4/html5/thumbnails/18.jpg)
Running the VSC
enEXE
MARMEM1LAT
ACC2LAT
1PCPC
04IRMAR
MARMEMIR
PCMAR
][
:
][
![Page 19: Computing Machinery Chapter 8: The Very Simple Computer](https://reader034.fdocuments.net/reader034/viewer/2022051419/56815a65550346895dc7aee4/html5/thumbnails/19.jpg)
Running the VSC
enEXE
MARMEM1LAT
ACC2LAT
1PCPC
04IRMAR
MARMEMIR
PCMAR
][
:
][
![Page 20: Computing Machinery Chapter 8: The Very Simple Computer](https://reader034.fdocuments.net/reader034/viewer/2022051419/56815a65550346895dc7aee4/html5/thumbnails/20.jpg)
Control UnitExecuting OpCodes
LDAen - load ACC enable - moves value in LAT1 into ACC
STAen - store ACC enable - moves value in ACC into MEM[MAR]
ADDen - ADD enable
CMPen - CMP (1's complement) enable - takes the bitwise inverse of LAT1
BNNen - if(ACC7 = 0) then PC = IR<4:0>
SHLen - shift-left enable
SHRen - shift-right enable
HLTen - halts the fetch-execute cycle by setting
ControlUnit
IR
![Page 21: Computing Machinery Chapter 8: The Very Simple Computer](https://reader034.fdocuments.net/reader034/viewer/2022051419/56815a65550346895dc7aee4/html5/thumbnails/21.jpg)
PCre - PC read enable
PCwe - PC write enable
PCinc - PC increment
MARwe - MAR write enable
IRre - IR read enable
IRwe - IR write enable
LAT1we - LAT1 write enable
LAT2we - LAT2 write enable
ACCwe - ACC write enable (from ALU only)
ACCre - ACC read enable (we read the ACC through the bus)
Control UnitFetch Operations
![Page 22: Computing Machinery Chapter 8: The Very Simple Computer](https://reader034.fdocuments.net/reader034/viewer/2022051419/56815a65550346895dc7aee4/html5/thumbnails/22.jpg)
VSC System Clock
![Page 23: Computing Machinery Chapter 8: The Very Simple Computer](https://reader034.fdocuments.net/reader034/viewer/2022051419/56815a65550346895dc7aee4/html5/thumbnails/23.jpg)
Fetch-Execute Cycle Timing Diagram
![Page 24: Computing Machinery Chapter 8: The Very Simple Computer](https://reader034.fdocuments.net/reader034/viewer/2022051419/56815a65550346895dc7aee4/html5/thumbnails/24.jpg)
Fetch-Execute Control Circuit
![Page 25: Computing Machinery Chapter 8: The Very Simple Computer](https://reader034.fdocuments.net/reader034/viewer/2022051419/56815a65550346895dc7aee4/html5/thumbnails/25.jpg)
VSC Instruction Decoder Circuit
![Page 26: Computing Machinery Chapter 8: The Very Simple Computer](https://reader034.fdocuments.net/reader034/viewer/2022051419/56815a65550346895dc7aee4/html5/thumbnails/26.jpg)
VSC Memory Unit
![Page 27: Computing Machinery Chapter 8: The Very Simple Computer](https://reader034.fdocuments.net/reader034/viewer/2022051419/56815a65550346895dc7aee4/html5/thumbnails/27.jpg)
Arithmetic Logic Unit
![Page 28: Computing Machinery Chapter 8: The Very Simple Computer](https://reader034.fdocuments.net/reader034/viewer/2022051419/56815a65550346895dc7aee4/html5/thumbnails/28.jpg)
Bitwise Complement and Shift Operations
![Page 29: Computing Machinery Chapter 8: The Very Simple Computer](https://reader034.fdocuments.net/reader034/viewer/2022051419/56815a65550346895dc7aee4/html5/thumbnails/29.jpg)
74181 - A 4-Bit ALU
![Page 30: Computing Machinery Chapter 8: The Very Simple Computer](https://reader034.fdocuments.net/reader034/viewer/2022051419/56815a65550346895dc7aee4/html5/thumbnails/30.jpg)
VSC Input/Output
![Page 31: Computing Machinery Chapter 8: The Very Simple Computer](https://reader034.fdocuments.net/reader034/viewer/2022051419/56815a65550346895dc7aee4/html5/thumbnails/31.jpg)
Programming the VSC
addr label instruction addr machine code .
0 LDA A 00000 00000100
1 ADD B 00001 01000101
2 STO C 00010 00100110
3 HLT 00011 11111111
4 A 24 00100 00011000
5 B 30 00101 00011110
6 C 0 00110 00000000
![Page 32: Computing Machinery Chapter 8: The Very Simple Computer](https://reader034.fdocuments.net/reader034/viewer/2022051419/56815a65550346895dc7aee4/html5/thumbnails/32.jpg)
Loops in the VSC
![Page 33: Computing Machinery Chapter 8: The Very Simple Computer](https://reader034.fdocuments.net/reader034/viewer/2022051419/56815a65550346895dc7aee4/html5/thumbnails/33.jpg)
What is This?
00000 00010001
00001 11000000
00010 10100000
00011 00110010
00100 00010001
00101 01100000
00110 01010011
00111 01010010
01000 10001101
01001 00001111
01010 10100000
01011 00010100
01100 10001111
01101 00010001
01110 11000000
01111 00110001
10000 11111111
10001 00000111
10010 00000000
10011 00000001
10100 00000000