(Assembly Language) Computer Architecture

47
11/7/2013 1 CSW 353 (Assembly Language) Computer Architecture Dr. Salma Hamdy [email protected]

Transcript of (Assembly Language) Computer Architecture

Page 1: (Assembly Language) Computer Architecture

11/7/2013 1

CSW 353 (Assembly Language)

Computer Architecture

Dr. Salma Hamdy [email protected]

Page 2: (Assembly Language) Computer Architecture

Computer System Architecture

2

Chapter 1: Digital Logic Circuits Chapter 2: Digital Components Chapter 3: Data Representation Chapter 4: Register Transfer and Microoperations

Chapter 5: Basic Computer Organization Chapter 6: Programming the Basic Computer Chapter 7: Microporgammed Control

Chapter 8: CPU

Chapter 11: I/O Organization

Chapter 12: Memory Organization

Page 3: (Assembly Language) Computer Architecture

Basic Computer Organization and

Design - II 1. Memory-Reference Instructions 2. Register Reference Instructions 3. Input-Output and Interrupts 4. Design of Basic Computer 5. Design of Accumulator Logic

The three types of instructions, their register transfer statements, and their control functions. Connecting all into a basic computer.

Page 4: (Assembly Language) Computer Architecture

4 11/7/2013

Page 5: (Assembly Language) Computer Architecture

1. Memory-Reference Instructions

โ€ข ๐‘ฐ๐‘น(12-14) to decoder outputs ๐‘ซ๐Ÿ๐‘ซ๐Ÿโ€ฆ. ๐‘ซ๐Ÿ” which specifies one of 7 operations.

โ€ข Effective address was stored in ๐‘จ๐‘น during ๐‘ป๐Ÿ (when ๐‘ฐ = ๐ŸŽ), or during ๐‘ป๐Ÿ‘ (when ๐‘ฐ = ๐Ÿ).

โ€ข Execution starts with timing sequence ๐‘ป๐Ÿ’.

โ€ข Actual execution requires a sequence of microoperations as data stored in memory cannot be processed directly.

5 11/7/2013

Page 6: (Assembly Language) Computer Architecture

1. Memory-Reference Instructions โ€“ (cont.)

6 11/7/2013

Page 7: (Assembly Language) Computer Architecture

1. Memory-Reference Instructions โ€“ (cont.)

And to ๐‘จ๐‘ช

โ€ข Performs the AND logic operation on the pair of bits in ๐‘จ๐‘ช and the memory specified by the effective address.

7 11/7/2013

Page 8: (Assembly Language) Computer Architecture

1. Memory-Reference Instructions โ€“ (cont.)

BUN (Branch Unconditionally)

โ€ข Transfers the program to the instruction specified by the effective address (jump).

8 11/7/2013

Page 9: (Assembly Language) Computer Architecture

1. Memory-Reference Instructions โ€“ (cont.)

BUN (Branch Unconditionally)

โ€ข Transfers the program to the instruction specified by the effective address (jump).

9 11/7/2013

Page 10: (Assembly Language) Computer Architecture

1. Memory-Reference Instructions โ€“ (cont.)

BSA (Branch and Save Return Address)

โ€ข Branches to a subroutine or procedure (call).

โ€“ Stores the address of the next instruction of the main program, in a memory location specified by effective address (top of subroutine).

โ€“Branches to address of first instruction of subroutine (the one right after the effective address).

10 11/7/2013

Page 11: (Assembly Language) Computer Architecture

1. Memory-Reference Instructions โ€“ (cont.)

BSA Example

11 11/7/2013

Page 12: (Assembly Language) Computer Architecture

1. Memory-Reference Instructions โ€“ (cont.)

12 11/7/2013

Page 13: (Assembly Language) Computer Architecture

1. Memory-Reference Instructions โ€“ (cont.)

โ€ข Only seven timing sequences needed to execute the longest instruction.

โ€ข Sequence Counter size?

13 11/7/2013

Page 14: (Assembly Language) Computer Architecture

2. Register Reference Instructions

โ€ข ๐‘ซ๐Ÿ• = ๐Ÿ and ๐‘ฐ = ๐ŸŽ, with timing sequence ๐‘ป๐Ÿ‘.

โ€ข ๐‘ฐ๐‘น(0-11) specify one of 12 instructions.

โ€ข Let the bits of ๐‘ฐ๐‘น be ๐‘ฉ๐Ÿ๐Ÿ๐‘ฉ๐Ÿ๐ŸŽโ€ฆ. ๐‘ฉ๐ŸŽ.

โ€ข Let the Boolean relation ๐‘ซ๐Ÿ•๐‘ฐโ€ฒ๐‘ป๐Ÿ‘ = ๐ซ.

โ€ข Since the control function is distinguished by one of the bits in ๐‘ฐ๐‘น(0-11), then all control functions can be simply denoted by ๐’“๐‘ฉ๐’Š.

14 11/7/2013

Page 15: (Assembly Language) Computer Architecture

2. Register Reference Instructions โ€“ (cont.)

โ€ข Example: CLA

Hex. 7 8 0 0

Binary 0 111 1000 000 000

Control function that initiates the microoperations for this instruction is: ๐‘ซ๐Ÿ•๐‘ฐโ€ฒ๐‘ป๐Ÿ‘๐‘ฉ๐Ÿ๐Ÿ = ๐’“๐‘ฉ๐Ÿ๐Ÿ

15 11/7/2013

๐‘ฐโ€™ ๐‘ซ๐Ÿ• ๐‘ฉ๐Ÿ๐Ÿ

Page 16: (Assembly Language) Computer Architecture

2. Register Reference Instructions โ€“ (cont.)

16 11/7/2013

Page 17: (Assembly Language) Computer Architecture

2. Register Reference Instructions โ€“ (cont.)

โ€ข ๐‘บ๐‘ช is cleared after the execution of each instruction initiating ๐‘ป๐ŸŽ (fetch) again that causes a new cycle.

โ€ข After a HALT, the start flip-flip must be set manually.

17 11/7/2013

Page 18: (Assembly Language) Computer Architecture

3. Input-Output Instructions

18 11/7/2013

Input-Output Configuration

Page 19: (Assembly Language) Computer Architecture

3. Input-Output Instructions โ€“ (cont.)

19 11/7/2013

โ€ข ๐‘ซ๐Ÿ• = ๐Ÿ and ๐‘ฐ = ๐Ÿ, with timing sequence ๐‘ป๐Ÿ‘.

โ€ข ๐‘ฐ๐‘น(0-11) specify one of 12 instructions.

โ€ข Let the bits of ๐‘ฐ๐‘น be ๐‘ฉ๐Ÿ๐Ÿ๐‘ฉ๐Ÿ๐ŸŽโ€ฆ. ๐‘ฉ๐ŸŽ.

โ€ข Let the Boolean relation ๐‘ซ๐Ÿ•๐‘ฐ๐‘ป๐Ÿ‘ = ๐ฉ.

โ€ข Since the control function is distinguished by one of the bits in ๐‘ฐ๐‘น(0-11), then all control functions can be simply denoted by ๐’‘๐‘ฉ๐’Š.

Page 20: (Assembly Language) Computer Architecture

3. Input-Output Instructions โ€“ (cont.)

20 11/7/2013

โ€ข ๐‘บ๐‘ช is cleared after the execution of each instruction initiating ๐‘ป๐ŸŽ (fetch) again that causes a new cycle.

Programmed control transfer

Page 21: (Assembly Language) Computer Architecture

3. Input-Output Instructions

21 11/7/2013

Interrupts

โ€ข Instead of wasting time by checking flags, let the external device inform the computer when it is ready for transfer.

โ€ข Interrupt enable flip-flop ๐‘ฐ๐‘ฌ๐‘ต.

โ€ข ๐‘ฐ๐‘ฌ๐‘ต = ๐ŸŽ (with the ๐‘ฐ๐‘ถ๐‘ญ instruction) flags cannot interrupt computer.

โ€ข ๐‘ฐ๐‘ฌ๐‘ต = ๐Ÿ (with the ๐‘ฐ๐‘ถ๐‘ต instruction) computer can be interrupted.

Page 22: (Assembly Language) Computer Architecture

3. Input-Output Instructions

22 11/7/2013

Interrupt Cycle

โ€ข Interrupt flag ๐‘น.

Page 23: (Assembly Language) Computer Architecture

3. Input-Output Instructions

23 11/7/2013

Interrupt Cycle

โ€ข Initiated after last execution phase if ๐‘น = ๐Ÿ.

โ€ข That is, if ๐‘ฐ๐‘ฌ๐‘ต = ๐Ÿ, and either ๐‘ญ๐‘ฎ๐‘ฐ or ๐‘ญ๐‘ฎ๐‘ถ are 1. Happens with any clock transition except when timing signals ๐‘ป๐ŸŽ, ๐‘ป๐Ÿ, ๐‘ป๐Ÿ are active.

Page 24: (Assembly Language) Computer Architecture

3. Input-Output Instructions

24 11/7/2013

Interrupt Cycle Example

Page 25: (Assembly Language) Computer Architecture

3. Input-Output Instructions

25 11/7/2013

Modified Fetch and Decode Phases

โ€ข ??

Page 26: (Assembly Language) Computer Architecture

4. Complete Computer Description

โ€ข Flowchart of the basic computer operation Fig 5-15.

โ€ข Control functions and microoperations of the basic computer Table 5-6.

26 11/7/2013

Page 27: (Assembly Language) Computer Architecture

5. Design of Basic Computer

Components:

โ€“Memory unit 4096ร—16.

โ€“Nine registers: ๐‘จ๐‘น, ๐‘ท๐‘ช, ๐‘ซ๐‘น, ๐‘จ๐‘ช, ๐‘ฐ๐‘น, ๐‘ป๐‘น, ๐‘ถ๐‘ผ๐‘ป๐‘น, ๐‘ฐ๐‘ต๐‘ท๐‘น, ๐‘บ๐‘ช.

โ€“ Seven flip-flops: ๐‘ฐ, ๐‘บ, ๐‘ฌ, ๐‘น, ๐‘ฐ๐‘ฌ๐‘ต, ๐‘ญ๐‘ฎ๐‘ฐ, ๐‘ญ๐‘ฎ๐‘ถ.

โ€“Two decoders: a 3ร—8 operation decoder, and a 4ร—16 timing decoder.

โ€“A 16-bit common bus.

โ€“Control logic gates.

โ€“Adder and logic circuit connected to ๐‘จ๐‘ช. 27 11/7/2013

Page 28: (Assembly Language) Computer Architecture

5. Design of Basic Computer โ€“ (cont.)

Control Logic Gate

โ€ข Input: decoders output, ๐‘ฐ๐‘น(0-11), ๐‘จ๐‘ช, ๐‘ซ๐‘น, the 7 flip-flops.

28 11/7/2013

Page 29: (Assembly Language) Computer Architecture

5. Design of Basic Computer โ€“ (cont.)

Control Logic Gate

โ€ข Output: โ€“ Signals to control the input of the nine registers.

โ€“ Signals to control the read and write input of memory.

โ€“ Signals to set, clear, or complement the flip-flips.

โ€“ Signals for ๐‘บ๐Ÿ, ๐‘บ๐Ÿ, and ๐‘บ๐ŸŽ to select a register for the bus.

โ€“ Signals to control ๐‘จ๐‘ช adder and logic circuit.

โ€ข The specs of various control signals comes directly from Table 5-6.

29 11/7/2013

Page 30: (Assembly Language) Computer Architecture

5. Design of Basic Computer โ€“ (cont.)

Control for Registers, Memory and Flip-Flops

โ€ข Registers control inputs are LD, INR, and CLR.

โ€ข Example: to find the gate structure associated with the control inputs of ๐‘จ๐‘น, scan Table 5-6 to find all statements that change content of AR.

30 11/7/2013

Page 31: (Assembly Language) Computer Architecture

5. Design of Basic Computer โ€“ (cont.)

Control for Registers, Memory and Flip-Flops

โ€ข Example: control inputs of ๐‘จ๐‘น

31 11/7/2013

Page 32: (Assembly Language) Computer Architecture

5. Design of Basic Computer โ€“ (cont.)

Control for Common Bus

โ€ข Each binary number is associated with a Boolean variable ๐’™.

32 11/7/2013

Page 33: (Assembly Language) Computer Architecture

5. Design of Basic Computer โ€“ (cont.)

Control for Common Bus

โ€ข Each binary number is associated with a Boolean variable ๐’™.

33 11/7/2013

Page 34: (Assembly Language) Computer Architecture

5. Design of Basic Computer โ€“ (cont.)

34 11/7/2013

Control for Common Bus

โ€ข Example: to find the logic that selects ๐‘จ๐‘น, scan Table 5-6 to find all statement that have ๐‘จ๐‘น as a source.

Page 35: (Assembly Language) Computer Architecture

5. Design of Basic Computer โ€“ (cont.)

35 11/7/2013

Control for Common Bus

โ€ข Example: to find the logic that selects ๐‘จ๐‘น, scan Table 5-6 to find all statement that have AR as a source.

Page 36: (Assembly Language) Computer Architecture

6. Design of Accumulator Logic

Control of ๐‘จ๐‘ช Register

โ€ข From Table 5-6 extract all statement that changes the content of ๐‘จ๐‘ช.

36 11/7/2013

Page 37: (Assembly Language) Computer Architecture

6. Design of Accumulator Logic โ€“ (cont.)

Control of ๐‘จ๐‘ช Register

โ€ข From Table 5-6 extract all statement that changes the content of ๐‘จ๐‘ช.

37 11/7/2013

Page 38: (Assembly Language) Computer Architecture

6. Design of Accumulator Logic โ€“ (cont.)

Control of ๐‘จ๐‘ช Register

38 11/7/2013

๐‘ซ๐Ÿ•๐‘ฐโ€ฒ๐‘ป๐Ÿ‘ = ๐ซ

Page 39: (Assembly Language) Computer Architecture

6. Design of Accumulator Logic โ€“ (cont.)

Control of Adder and Logic Circuit (one stage)

โ€ข Can be divided into 16 stages, each stage corresponds to one it in ๐‘จ๐‘ช.

โ€ข Each stage contains seven AND gates (one for each operation), one OR gate (combining all), and a full adder.

39 11/7/2013

Page 40: (Assembly Language) Computer Architecture

6. Design of Accumulator Logic โ€“ (cont.)

Control of Adder and Logic Circuit (one stage)

40 11/7/2013

Page 41: (Assembly Language) Computer Architecture

Selected Problems

41 11/7/2013

REMARK: registers on the bus are numbered from 1 to 7, meaning that terminal 0 of MUX (selected by ๐’”๐Ÿ๐’”๐Ÿ๐’”๐ŸŽ=000) does not contribute to transfers through the bus.

111

001

010

011

100

101

110

Page 42: (Assembly Language) Computer Architecture

Selected Problems โ€“ (cont.)

42 11/7/2013

Page 43: (Assembly Language) Computer Architecture

Selected Problems โ€“ (cont.)

43 11/7/2013

Page 44: (Assembly Language) Computer Architecture

Selected Problems โ€“ (cont.)

44 11/7/2013

Page 45: (Assembly Language) Computer Architecture

Selected Problems โ€“ (cont.)

45 11/7/2013

Page 46: (Assembly Language) Computer Architecture

Next Lecture

Revision + problem solving.

46 11/7/2013

Assignment

- Reading: Chapter 5: sections 6-10.

Page 47: (Assembly Language) Computer Architecture

References

- Digital Design, 4th ed, M. Morris Mano, Prentice Hall, 2006.

-http://microcom.kut.ac.kr/ ch05

- God bless Google and Wiki!

47 11/7/2013