Languages, and Digital Logic

Size: px
Start display at page:

Download "Languages, and Digital Logic"

Transcription

1 2-1 Chapter 2 Machines, Machine Languages, and Digital Logic Chapter 2: Machines, Machine Languages, and Digital Logic Topics 2.1 Classification of Coputers and Their Instructions 2.2 Coputer Instruction Sets 2.3 Inforal Description of the Siple RISC Coputer, SRC 2.4 Foral Description of SRC Using Register Transfer Notation, RTN 2.5 Describing Addressing Modes with RTN 2.6 Register Transfers and Logic Circuits: Fro Behavior to Hardware

2 2-2 Chapter 2 Machines, Machine Languages, and Digital Logic What Are the Coponents of an ISA? Soeties known as The Prograer s Model of the achine Storage cells General and special purpose registers in the CPU Many general purpose cells of sae size in eory Storage associated with I/O devices The achine instruction set The instruction set is the entire repertoire of achine operations Makes use of storage cells, forats, and results of the fetch/ execute cycle i.e., register transfers The instruction forat Size and eaning of fields within the instruction The nature of the fetch-execute cycle Things that are done before the operation code is known

3 2-3 Chapter 2 Machines, Machine Languages, and Digital Logic Fig. 2.1 Prograer s Models of Various Machines We saw in Chap. 1 a variation in nuber and type of storage cells M6800 I8086 VAX11 PPC601 (introduced 1975) (introduced 1979) (introduced 1981) (introduced 1993) special purpose registers 2 16 bytes of ain eory capacity Fewer than 100 instructions A B IX SP PC Status Data registers Address and count registers Meory segent registers 2 20 bytes of ain eory capacity More than 120 instructions AX BX CX DX SP BP SI DI CS DS SS ES IP Status general purpose registers 2 32 bytes of ain eory capacity More than 300 instructions More than 250 instructions R0 R11 AP FP SP PC PSW bit floating point registers bit general purpose registers More than bit special purpose registers 2 52 bytes of ain eory capacity

4 2-4 Chapter 2 Machines, Machine Languages, and Digital Logic What Must an Instruction Specify? Data Flow Which operation to perfor add r0, r1, r3 Ans: Op code: add, load, branch, etc. Where to find the operand or operands add r0, r1, r3 In CPU registers, eory cells, I/O locations, or part of instruction Place to store result add r0, r1, r3 Again CPU register or eory cell Location of next instruction add r0, r1, r3 br endloop Alost always eory cell pointed to by progra counter PC Soeties there is no operand, or no result, or no next instruction. Can you think of exaples?

5 2-5 Chapter 2 Machines, Machine Languages, and Digital Logic Instructions Can Be Divided into 3 Classes Data oveent instructions Move data fro a eory location or register to another eory location or register without changing its for Load source is eory and destination is register Store source is register and destination is eory Arithetic and logic (ALU) instructions Change the for of one or ore operands to produce a result stored in another location Add, Sub, Shift, etc. Branch instructions (control flow instructions) Alter the noral flow of control fro executing the next instruction in sequence Br Loc, Brz Loc2, unconditional or conditional branches

6 2-6 Chapter 2 Machines, Machine Languages, and Digital Logic Tbl 2.1 Exaples of Data Moveent Instructions Instruction Meaning Machine MOV A, B Move 16 bits fro eory location A to VAX11 Location B LDA A, Addr Load accuulator A with the byte at eory M6800 location Addr lwz R3, A Move 32-bit data fro eory location A to PPC601 register R3 li $3, 455 Load the 32-bit integer 455 into register $3 MIPS R3000 ov R4, dout Move 16-bit data fro R4 to output port dout DEC PDP11 IN, AL, KBD Load a byte fro in port KBD to accuulator Intel Pentiu LEA.L (A0), A2 Load the address pointed to by A0 into A2 M6800 Lots of variation, even with one instruction type

7 2-7 Chapter 2 Machines, Machine Languages, and Digital Logic Tbl 2.2 Exaples of ALU Instructions Instruction Meaning Machine MULF A, B, C ultiply the 32-bit floating point values at VAX11 e loc ns. A and B, store at C nabs r3, r1 Store abs value of r1 in r3 PPC601 ori $2, $1, 255 Store logical OR of reg $ 1 with 255 into reg $2 MIPS R3000 DEC R2 Decreent the 16-bit value stored in reg R2 DEC PDP11 SHL AX, 4 Shift the 16-bit value in reg AX left by 4 bit pos ns. Intel 8086 Notice again the coplete dissiilarity of both syntax and seantics.

8 2-8 Chapter 2 Machines, Machine Languages, and Digital Logic Tbl 2.3 Exaples of Branch Instructions Instruction Meaning Machine BLSS A, Tgt Branch to address Tgt if the least significant VAX11 bit of e loc n. A is set (i.e. = 1) bun r2 Branch to location in R2 if result of previous PPC601 floating point coputation was Not a Nuber (NAN) beq $2, $1, 32 Branch to location (PC ) if contents MIPS R3000 of $1 and $2 are equal SOB R4, Loop Decreent R4 and branch to Loop if R4 0 DEC PDP11 JCXZ Addr Jup to Addr if contents of register CX 0. Intel 8086

9 2-9 Chapter 2 Machines, Machine Languages, and Digital Logic CPU Registers Associated with Flow of Control Branch Instructions Progra counter usually locates next instruction Condition codes ay control branch Branch targets ay be separate registers Processor State C N V Z Progra Counter Condition Codes Branch Targets

10 2-10 Chapter 2 Machines, Machine Languages, and Digital Logic HLL Conditionals Ipleented by Control Flow Change Conditions are coputed by arithetic instructions Progra counter is changed to execute only instructions associated with true conditions C language if NUM==5 then SET=7 Assebly language CMP.W #5, NUM BNE L1 MOV.W #7, SET L1... ;the coparison ;conditional branch ;action if true ;action if false

11 2-11 Chapter 2 Machines, Machine Languages, and Digital Logic CPU Registers May Have a Personality Architecture classes are often based on how where the operands and result are located and how they are specified by the instruction. They can be in CPU registers or ain eory: Stack Arithetic Registers Address Registers General Purpose Registers Push Pop Top Second Stack Machine Accuulat or Machine General Regist er Machine

12 2-12 Chapter 2 Machines, Machine Languages, and Digital Logic 3-, 2-, 1-, & 0-Address ISAs The classification is based on arithetic instructions that have two operands and one result The key issue is how any of these are specified by eory addresses, as opposed to being specified iplicitly A 3-address instruction specifies eory addresses for both operands and the result R Op1 op Op2 A 2-address instruction overwrites one operand in eory with the result Op2 Op1 op Op2 A 1-address instruction has a processor, called the accuulator register, to hold one operand & the result (no addr. needed) Acc Acc op Op1 A 0-address + uses a CPU register stack to hold both operands and the result TOS TOS op SOS (where TOS is Top Of Stack, SOS is Second On Stack) The 4-address instruction, hardly ever seen, also allows the address of the next instruction to specified explicitly

13 2-13 Chapter 2 Machines, Machine Languages, and Digital Logic Fig 2.2 The 4-Address Machine and Instruction Forat Meory CPU add, Res, Op1, Op2, Nexti (Res Op1 + Op2) Op1Addr: Op2Addr: Op1 Op2 ResAddr: Res NextiAddr: Nexti Instruction forat Bits: add ResAddr Op1Addr Op2Addr NextiAddr Which operation Where to put result Where to find operands Explicit addresses for operands, result, & next instruction Exaple assues 24-bit addresses Discuss: size of instruction in bytes Where to find next instruction

14 2-14 Chapter 2 Machines, Machine Languages, and Digital Logic Fig 2.3 The 3-Address Machine and Instruction Forat Meory CPU add, Res, Op1, Op2 (Res Op2 + Op1) Op1Addr: Op2Addr: Op1 Op2 ResAddr: Res NextiAddr: Nexti Progra counter Where to find next instruction 24 Instruction forat Bits: Address of next instruction kept in processor state register the PC (except for explicit branches/jups) Rest of addresses in instruction Discuss: savings in instruction word size 24 add ResAddr Op1Addr Op2Addr Which operation Where to put result Where to find operands

15 2-15 Chapter 2 Machines, Machine Languages, and Digital Logic Fig 2.4 The 2-Address Machine and Instruction Forat Meory CPU add Op2, Op1 (Op2 Op2 + Op1) Op1Addr: Op1 Op2Addr: Op2,Res NextiAddr: Nexti Progra counter 24 Where to find next instruction Instruction forat Bits: add Op2Addr Op1Addr Which Where to find operands operation Where to put result Result overwrites Operand 2 Needs only 2 addresses in instruction but less choice in placing data

16 2-16 Chapter 2 Machines, Machine Languages, and Digital Logic Fig Address Machine and Instruction Forat Meory CPU add Op1 (Acc Acc + Op1) Op1Addr: Op1 Accuulator Where to find operand2, and where to put result NextiAddr: Nexti Need instructions to load and store operands: LDA OpAddr STA OpAddr Progra counter Where to find next instruction Special CPU register, the accuulator, supplies 1 operand and stores result One eory address used for other operand Instruction forat Bits: add Which operation Op1Addr Where to find operand1

17 2-17 Chapter 2 Machines, Machine Languages, and Digital Logic Fig 2.6 The 0-Address, or Stack, Machine and Instruction Forat Instruction forats Meory CPU push Op1 (TOS Op1) Op1Addr: NextiAddr: Op1 Nexti TOS SOS etc. Stack Progra counter Where to find next instruction Uses a push-down stack in CPU Arithetic uses stack for both operands and the result Coputer ust have a 1-address instruction to push and pop operands to and fro the stack 24 Bits: Forat push Operation Forat 8 24 Op1Addr add (TOS TOS + SOS) Bits: 8 Result add Which operation Where to find operands, and where to put result (on the stack)

18 2-18 Chapter 2 Machines, Machine Languages, and Digital Logic Exaple 2.1 Expression Evaluation for 3-, 2-, 1-, and 0-Address Machines 3 - a d d r e s s 2 - a d d r e s s 1 - a d d r e s s S t a c k add a, b, c py a, a, d sub a, a, e Evaluate a = (b+c)*d - e load a, b add a, c py a, d sub a, e load b add c py d sub e store a push b push c add push d py push e sub pop a Nuber of instructions & nuber of addresses both vary Discuss as exaples: size of code in each case

19 2-19 Chapter 2 Machines, Machine Languages, and Digital Logic Fig 2.7 General Register Machine and Instruction Forats CPU Meory Registers Instruction forats Op1Addr: Op1 load R8 load R8, Op1 (R8 Op1) load R8 Op1Addr R6 R4 add R2, R4, R6 (R2 R4 + R6) R2 add R2 R4 R6 Nexti Progra counter It is the ost coon choice in today s general-purpose coputers Which register is specified by sall address (3 to 6 bits for 8 to 64 registers) Load and store have one long & one short address: 1-1/2 addresses Arithetic instruction has 3 half addresses

20 2-20 Chapter 2 Machines, Machine Languages, and Digital Logic Real Machines Are Not So Siple Most real achines have a ixture of 3, 2, 1, 0, and 1-1/2 address instructions A distinction can be ade on whether arithetic instructions use data fro eory If ALU instructions only use registers for operands and result, achine type is load-store Only load and store instructions reference eory Other achines have a ix of register-eory and eory-eory instructions

21 2-21 Chapter 2 Machines, Machine Languages, and Digital Logic Addressing Modes An addressing ode is hardware support for a useful way of deterining a eory address Different addressing odes solve different HLL probles Soe addresses ay be known at copile tie, e.g., global variables Others ay not be known until run tie, e.g., pointers Addresses ay have to be coputed. Exaples include: Record (struct) coponents: variable base (full address) + constant (sall) Array coponents: constant base (full address) + index variable (sall) Possible to store constant values w/o using another eory cell by storing the with or adjacent to the instruction itself

22 2-22 Chapter 2 Machines, Machine Languages, and Digital Logic HLL Exaples of Structured Addresses C language: rec count rec is a pointer to a record: full address variable count is a field nae: fixed byte offset, say 24 Rec C language: v[i] v is fixed base address of array: full address constant i is nae of variable index: no larger than array size V Variables ust be contained in registers or eory cells Sall constants can be contained in the instruction Result: need for address arithetic. E.g., Address of Rec Count is address of Rec + offset of count. Count V[i]

23 2-23 Chapter 2 Machines, Machine Languages, and Digital Logic Fig 2.8 Coon Addressing Modes a) Iediate Addressing (Instruction contains the operand.) b) Direct Addressing (Instruction contains address of operand) Meory Instr Op'n 3 LOAD #3,... c) Indirect Addressing (Instruction contains address of address of operand) Instr Op'n LOAD (A),... Meory Operand Operand Addr Address of address of A Instr Op'n Addr of A LOAD A,... Operand d) Register Indirect Addressing (register contains address of operand) Meory Instr Op'n R2... R2 Operand Addr. LOAD [R2],... Operand e) Displaceent (Based) (Indexed) Addressing (address of operand = register +constant) Instr Op'n R2 4 Meory f) Relative Addressing (Address of operand = PC+constant) Instr Op'n 4 Meory + Operand + Operand R2 PC LOAD 4[R2],... Operand Addr. LOADRel 4[PC],... Operand Addr.

24 2-24 Chapter 2 Machines, Machine Languages, and Digital Logic Exaple: Coputer, SRC Siple RISC Coputer 32 general purpose registers of 32 bits 32-bit progra counter, PC, and instruction register, IR 2 32 bytes of eory address space The SRC CPU Main eory R0 R31 PC IR bit general purpose registers 2 32 bytes of ain eory R[7] eans contents of register 7 M[32] eans contents of eory location 32

25 2-25 Chapter 2 Machines, Machine Languages, and Digital Logic SRC Characteristics Load-store design: only way to access eory is through load and store instructions Only a few addressing odes are supported ALU instructions are 3-register type Branch instructions can branch unconditionally or conditionally on whether the value in a specified register is = 0, <> 0, >= 0, or < 0 Branch and link instructions are siilar, but leave the value of current PC in any register, useful for subroutine return All instructions are 32 bits (1 word) long

26 2-26 Chapter 2 Machines, Machine Languages, and Digital Logic SRC Basic Instruction Forats There are three basic instruction forat types The nuber of register specifier fields and length of the constant field vary Other forats result fro unused fields or parts Details of forats on next slide op r a c1 Type op ra rb c2 0 Type op ra rb rc c3 0 Type 3

27 2-27 Chapter 2 Machines, Machine Languages, and Digital Logic Fig 2.9 (Partial) Total of 7 Detailed Forats 1. Id, st, la, addi, andi, ori Instruction forats Op ra rb c Idr, str, lar Op ra c neg, not Op ra rc unused unused br Op rb rc (c3) unused Cond unused brl Op ra rb rc (c3) unused Cond Id r3, A Id r3, 4(r5) addi r2, r4, #1 Idr r5, 8 Iar r6, 45 neg r7, r9 Exaple (R[3] = M[A]) (R[3] = M[R[5] + 4]) (R[2] = R[4] +1) (R[5] = M[PC + 8]) (R[6] = PC + 45) (R[7] = R[9]) brzr r4, r0 (branch to R[4] if R[0] == 0) brlnz r6, r4, r0 (R[6] = PC; branch to R[4] if R[0] 0) 6. add, sub, and, or Op ra rb rc unused add r0, r2, r4 (R[0] = R[2] + R[4]) 7. shr, shra shl, shic 7a 7b Op ra rb (c3) unused Count Op ra rb rc (c3) unused shr r0, r1, #4 (R[0] = R[1] shifted right by 4 bits shl r2, r4, r6 (R[2] = R[4] shifted left by count in R[6]) nop, stop Op unused stop

28 2-28 Chapter 2 Machines, Machine Languages, and Digital Logic Tbl 2.4 Exaple SRC Load and Store Instructions Address can be constant, constant + register, or constant + PC Meory contents or address itself can be loaded Instruction op ra rb c1 Meaning Addressing Mode ld r1, R[1] M[32] Direct ld r22, 24(r4) R[22] M[24+R[4]] Displaceent st r4, 0(r9) M[R[9]] R[4] Register indirect la r7, R[7] 32 Iediate ldr r12, R[12] M[PC -48] Relative lar r3, R[3] PC Register (!) (note use of la to load a constant)

29 2-29 Chapter 2 Machines, Machine Languages, and Digital Logic Assebly Language Fors of Arithetic and Logic Instructions Forat Exaple Meaning neg ra, rc neg r1, r2 ;Negate (r1 = -r2) not ra, rc not r2, r3 ;Not (r2 = r3 ) add ra, rb, rc add r2, r3, r4 ;2 s copleent addition sub ra, rb, rc ;2 s copleent subtraction and ra, rb, rc ;Logical and or ra, rb, rc ;Logical or addi ra, rb, c2 addi r1, r3, #1 ;Iediate 2 s copleent add andi ra, rb, c2 ;Iediate logical and ori ra, rb, c2 ;Iediate logical or Iediate subtract not needed since constant in addi ay be negative

30 2-30 Chapter 2 Machines, Machine Languages, and Digital Logic Branch Instruction Forat There are actually only two branch instructions: br rb, rc, c3<2..0> ; branch to R[rb] if R[rc] eets ; the condition defined by c3<2..0> brl ra, rb, rc, c3<2..0> ; R[ra] PC; branch as above It is c3<2..0>, the 3 lsbs of c3, that governs what the branch condition is: lsbs condition Assy language for Exaple 000 never brlnv brlnv r6 001 always br, brl br r5, brl r5 010 if rc = 0 brzr, brlzr brzr r2, r4, r5 011 if rc 0 brnz, brlnz 100 if rc 0 brpl, brlpl 101 if rc < 0 bri, brli Note that branch target address is always in register R[rb]. It ust be placed there explicitly by a previous instruction.

31 2-31 Chapter 2 Machines, Machine Languages, and Digital Logic Tbl 2.6 Fors and Forats of the br and brl Instructions Ass y lang. Exaple instr. Meaning op ra rb rc c Branch Cond n. brlnv brlnv r6 R[6] PC never br br r4 PC R[4] always brl brl r6,r4 R[6] PC; always PC R[4] brzr brzr r5,r1 if (R[1]=0) zero PC R[5] brlzr brlzr r7,r5,r1 R[7] PC; zero brnz brnz r1, r0 if (R[0] 0) PC R[1] nonzero brlnz brlnz r2,r1,r0 R[2] PC; nonzero if (R[0] 0) PC R[1] brpl brpl r3, r2 if (R[2] 0) PC R[3] plus brlpl brlpl r4,r3,r2 R[4] PC; plus if (R[2] 0) PC R[3] bri bri r0, r1 if (R[1]<0) PC R[0] inus brli brli r3,r0,r1 R[3] PC; if (r1<0) PC R[0] inus

32 2-32 Chapter 2 Machines, Machine Languages, and Digital Logic Branch Instructions Exaple C: goto Label3 SRC: reg. lar r0, Label3 br r0 ; put branch target address into tgt ; and branch Label3

33 2-33 Chapter 2 Machines, Machine Languages, and Digital Logic Exaple of Conditional Branch in C: #define Cost 125 if (X<0) then X = -X; in SRC: Cost.equ 125 ;define sybolic constant.org 1000 ;next word will be loaded at address X:.dw 1 ;reserve 1 word for variable X.org 5000 ;progra will be loaded at location lar r0, Over ;load address of false jup location ld r1, X ;load value of X into r1 brpl r0, r1 ;branch to Else if r1 0 neg r1, r1 ;negate value Over: ;continue

34 2-34 Chapter 2 Machines, Machine Languages, and Digital Logic RTN (Register Transfer Notation) Provides a foral eans of describing achine structure and function Is at the just right level for achine descriptions Does not replace hardware description languages Can be used to describe what a achine does (an abstract RTN) without describing how the achine does it Can also be used to describe a particular hardware ipleentation (a concrete RTN)

35 2-35 Chapter 2 Machines, Machine Languages, and Digital Logic RTN (cont d.) At first you ay find this eta description confusing, because it is a language that is used to describe a language You will find that developing a failiarity with RTN will aid greatly in your understanding of new achine design concepts We will describe RTN by using it to describe SRC

36 2-36 Chapter 2 Machines, Machine Languages, and Digital Logic Soe RTN Features Using RTN to Describe a Machine s Static Properties Static Properties Specifying registers IR specifies a register naed IR having 32 bits nubered 31 to 0 Naing using the := naing operator: op 4..0 := IR specifies that the 5 sbs of IR be called op, with bits 4..0 Notice that this does not create a new register, it just generates another nae, or alias, for an already existing register or part of a register

37 2-37 Chapter 2 Machines, Machine Languages, and Digital Logic Using RTN to Describe Dynaic Properties Dynaic Properties Conditional expressions: (op=12) R[ra] R[rb] + R[rc]: ; defines the add instruction if condition then RTN Assignent Operator This fragent of RTN describes the SRC add instruction. It says, when the op field of IR = 12, then store in the register specified by the ra field, the result of adding the register specified by the rb field to the register specified by the rc field.

38 2-38 Chapter 2 Machines, Machine Languages, and Digital Logic Using RTN to Describe the SRC (Static) Processor State Processor state PC : progra counter (eory addr. of next inst.) IR : instruction register Run: one bit run/halt indicator Strt: start signal R[0..31] : general purpose registers

39 2-39 Chapter 2 Machines, Machine Languages, and Digital Logic RTN Register Declarations General register specifications shows soe features of the notation Describes a set of bit registers with naes R[0] to R[31] R[0..31] : Nae of registers Register # in square brackets.. specifies a range of indices sb # lsb# Bit # in angle brackets Colon separates stateents with no ordering

40 2-40 Chapter 2 Machines, Machine Languages, and Digital Logic Meory Declaration: RTN Naing Operator Defining naes with foral paraeters is a powerful foratting tool Used here to define word eory (big-endian) Main eory state Me[ ] 7..0 : 232 addressable bytes of eory M[x] := Me[x]#Me[x+1]#Me[x+2]#Me[x+3]: Duy paraeter Naing operator Concatenation operator All bits in register if no bit index given

41 2-41 Chapter 2 Machines, Machine Languages, and Digital Logic RTN Instruction Foratting Uses Renaing of IR Bits Instruction forats op 4..0 := IR : ra 4..0 := IR : rb 4..0 := IR : rc 4..0 := IR : c := IR : c := IR : c := IR : operation code field target register field operand, address index, or branch target register second operand, conditional test, or shift count register long displaceent field short displaceent or iediate field count or odifier field

42 2-42 Chapter 2 Machines, Machine Languages, and Digital Logic Specifying Dynaic Properties of SRC: RTN Gives Specifics of Address Calculation Effective address calculations (occur at runtie): disp := ((rb=0) c {sign extend}: displaceent (rb 0) R[rb] + c {sign extend, 2 s cop.} ): address rel := PC c {sign extend, 2 s cop.}: relative address Renaing defines displaceent and relative addresses New RTN notation is used condition expression eans if condition then expression odifiers in { } describe type of arithetic or how short nubers are extended to longer ones arithetic operators (+ - * / etc.) can be used in expressions Register R[0] cannot be added to a displaceent

43 2-43 Chapter 2 Machines, Machine Languages, and Digital Logic Detailed Questions Answered by the RTN for Addresses What set of eory cells can be addressed by direct addressing (displaceent with rb=0) If c2 16 =0 (positive displaceent) absolute addresses range fro H to 0000FFFFH If c2 16 =1 (negative displaceent) absolute addresses range fro FFFF0000H to FFFFFFFFH What range of eory addresses can be specified by a relative address The largest positive value of C is and its ost negative value is -221, so addresses up to forward and 221 backward fro the current PC value can be specified Note the difference between rb and R[rb]

44 2-44 Chapter 2 Machines, Machine Languages, and Digital Logic Instruction Interpretation: RTN Description of Fetch-Execute Need to describe actions (not just declarations) Soe new notation Logical NOT Logical AND instruction_interpretation := ( Run Strt Run 1: Run (IR M[PC]: PC PC + 4; instruction_execution) ); Register transfer Separates stateents that occur in sequence

45 2-45 Chapter 2 Machines, Machine Languages, and Digital Logic RTN Sequence and Clocking In general, RTN stateents separated by : take place during the sae clock pulse Stateents separated by ; take place on successive clock pulses This is not entirely accurate since soe things written with one RTN stateent can take several clocks to perfor More precise difference between : and ; The order of execution of stateents separated by : does not atter If stateents are separated by ; the one on the left ust be coplete before the one on the right starts

46 2-46 Chapter 2 Machines, Machine Languages, and Digital Logic More About Instruction Interpretation RTN In the expression IR M[PC]: PC PC + 4; which value of PC applies to M[PC]? The rule in RTN is that all right hand sides of : - separated RTs are evaluated before any LHS is changed In logic design, this corresponds to aster-slave operation of flip-flops We see what happens when Run is true and when Run is false but Strt is true. What about the case of Run and Strt both false? Since no action is specified for this case, the RTN iplicitly says that no action occurs in this case

47 2-47 Chapter 2 Machines, Machine Languages, and Digital Logic Individual Instructions instruction_interpretation contained a forward reference to instruction_execution instruction_execution is a long list of conditional operations The condition is that the op code specifies a given instruction The operation describes what that instruction does Note that the operations of the instruction are done after (;) the instruction is put into IR and the PC has been advanced to the next instruction

48 2-48 Chapter 2 Machines, Machine Languages, and Digital Logic RTN Instruction Execution for Load and Store Instructions instruction_execution := ( ld (:= op= 1) R[ra] M[disp]: ldr (:= op= 2) R[ra] M[rel]: st (:= op= 3) M[disp] R[ra]: str (:= op= 4) M[rel] R[ra]: la (:= op= 5 ) R[ra] disp: lar (:= op= 6) R[ra] rel: load register load register relative store register store register relative load displaceent address load relative address The in-line definition (:= op=1) saves writing a separate definition ld := op=1 for the ld neonic The previous definitions of disp and rel are needed to understand all the details

49 2-49 Chapter 2 Machines, Machine Languages, and Digital Logic SRC RTN The Main Loop ii := instruction_interpretation: ie := instruction_execution : ii := ( Run Strt Run 1: Run (IR M[PC]: PC PC + 4; ie) ); ie := ( ld (:= op= 1) R[ra] M[disp]: Big switch ldr (:= op= 2) R[ra] M[rel]: stateent... on the opcode stop (:= op= 31) Run 0: ); ii Thus ii and ie invoke each other, as coroutines.

50 2-50 Chapter 2 Machines, Machine Languages, and Digital Logic Use of RTN Definitions: Text Substitution Seantics ld (:= op= 1) R[ra] M[disp]: disp := ((rb=0) c {sign extend}: (rb 0) R[rb] + c {sign extend, 2 s cop.} ): ld (:= op= 1) R[ra] M[ ((rb=0) c {sign extend}: (rb 0) R[rb] + c {sign extend, 2 s cop.} ): ]: An exaple: If IR = then ld R[5] M[ R[3] + 11 ]:

51 2-51 Chapter 2 Machines, Machine Languages, and Digital Logic RTN Descriptions of SRC Branch Instructions Branch condition deterined by 3 lsbs of instruction Link register (R[ra]) set to point to next instruction cond := ( c =0 0: c =1 1: c =2 R[rc]=0: c =3 R[rc] 0: c =4 R[rc] 31 =0: c =5 R[rc] 31 =1 ): br (:= op= 8) (cond PC R[rb]): brl (:= op= 9) (R[ra] PC: cond (PC R[rb]) ): never always if register is zero if register is nonzero if positive or zero if negative conditional branch branch and link

52 2-52 Chapter 2 Machines, Machine Languages, and Digital Logic RTN for Arithetic and Logic add (:= op=12) R[ra] R[rb] + R[rc]: addi (:= op=13) R[ra] R[rb] + c {2's cop. sign ext.}: sub (:= op=14) R[ra] R[rb] - R[rc]: neg (:= op=15) R[ra] -R[rc]: and (:= op=20) R[ra] R[rb] R[rc]: andi (:= op=21) R[ra] R[rb] c {sign extend}: or (:= op=22) R[ra] R[rb] R[rc]: ori (:= op=23) R[ra] R[rb] c {sign extend}: not (:= op=24) R[ra] R[rc]: Logical operators: and or and not

53 2-53 Chapter 2 Machines, Machine Languages, and Digital Logic RTN for Shift Instructions Count ay be 5 lsbs of a register or the instruction - replication, # - concatenation n := ( (c =0) R[rc] 4..0 : (c ) c ): shr (:= op=26) R[ra] ) # R[rb] 31..n : shra (:= op=27) R[ra] R[rb] 31 ) # R[rb] 31..n : shl (:= op=28) R[ra] R[rb] 31-n..0 # 0): shc (:= op=29) R[ra] R[rb] 31-n..0 # R[rb] n :

54 2-54 Chapter 2 Machines, Machine Languages, and Digital Logic Exaple of Replication and Concatenation in Shift Arithetic shift right by 13 concatenates 13 copies of the sign bit with the upper 19 bits of the operand shra r1, r2, 13 R[2]= R[1]= 13@R[2] # R[2]

55 2-55 Chapter 2 Machines, Machine Languages, and Digital Logic Assebly Language for Shift For of assebly language instruction tells whether to set c3=0 shr ra, rb, rc shr ra, rb, count shra ra, rb, rc shra ra, rb, count shl ra, rb, rc shl ra, rb, count shc ra, rb, rc shc ra, rb, count ;Shift rb right into ra by 5 lsbs of rc ;Shift rb right into ra by 5 lsbs of inst ;AShift rb right into ra by 5 lsbs of rc ;AShift rb right into ra by 5 lsbs of inst ;Shift rb left into ra by 5 lsbs of rc ;Shift rb left into ra by 5 lsbs of inst ;Shift rb circ. into ra by 5 lsbs of rc ;Shift rb circ. into ra by 5 lsbs of inst

56 2-56 Chapter 2 Machines, Machine Languages, and Digital Logic End of RTN Definition of instruction_execution nop (:= op= 0) : No operation stop (:= op= 31) Run 0: Stop instruction ); End of instruction_execution instruction_interpretation. We will find special use for nop in pipelining The achine waits for Strt after executing stop The long conditional stateent defining instruction_execution ends with a direction to go repeat instruction_interpretation, which will fetch and execute the next instruction (if Run still =1)

57 2-57 Chapter 2 Machines, Machine Languages, and Digital Logic Confused about RTN and SRC? SRC is a Machine Language It can be interpreted by either hardware or software siulator. RTN is a Specification Language Specification languages are languages that are used to specify other languages or systes a etalanguage. Other exaples: LEX, YACC, VHDL, Verilog Figure 2.10 ay help clear this up...

58 2-58 Chapter 2 Machines, Machine Languages, and Digital Logic Fig 2.10 The Relationship of RTN to SRC SRC specification written in RTN RTN copiler Generated processor SRC progra and data SRC interpreter or siulator Data output

59 2-59 Chapter 2 Machines, Machine Languages, and Digital Logic A Note About Specification Languages They allow the description of what without having to specify how. They allow precise and unabiguous specifications, unlike natural language. They reduce errors: Errors due to isinterpretation of iprecise specifications written in natural language. Errors due to confusion in design and ipleentation huan error. Now the designer ust debug the specification! Specifications can be autoatically checked and processed by tools. An RTN specification could be input to a siulator generator that would produce a siulator for the specified achine. An RTN specification could be input to a copiler generator that would generate a copiler for the language, whose output could be run on the siulator.

60 2-60 Chapter 2 Machines, Machine Languages, and Digital Logic Addressing Modes Described in RTN (Not SRC) Target register Mode nae Assebler RTN eaning Use Syntax Register Ra R[t] R[a] Tp. Var. Register indirect (Ra) R[t] M[R[a]] Pointer Iediate #X R[t] X Constant Direct, absolute X R[t] M[X] Global Var. Indirect (X) R[t] M[ M[X] ] Pointer Var. Indexed, based, X(Ra) R[t] M[X + R[a]] Arrays, structs or displaceent Relative X(PC) R[t] M[X + PC] Vals stored w pg Autoincreent (Ra)+ R[t] M[R[a]]; R[a] R[a] + 1 Sequential Autodecreent - (Ra) R[a] R[a] - 1; R[t] M[R[a]] access.

61 2-61 Chapter 2 Machines, Machine Languages, and Digital Logic Fig 2.11 Register Transfers Hardware and Tiing for a Single-Bit Register Transfer: A B Ipleenting the RTN stateent A B D B Q Q Strobe D A Q Q B Strobe A (a) Hardware (b) Tiing

62 2-62 Chapter 2 Machines, Machine Languages, and Digital Logic Fig 2.12 Multiple Bit Register Transfer: A..1 B..1 D Q 1 D Q 1 Q Q D Q 2 Q D Q 2 Q D Q B..1 D Q A..1 D Q Q D Q Q Q Strobe Q B Strobe A (a) Individual flip-flops (b) Abbreviated notation

63 2-63 Chapter 2 Machines, Machine Languages, and Digital Logic Fig 2.13 Data Transission View of Logic Gates Logic gates can be used to control the transission of data: data gate data gate data gate 0 Data gate control data data 1 data 2 data 1 data 2 data1(2), provided data2(1) is zero control control data Data erge Controlled copleent

64 2-64 Chapter 2 Machines, Machine Languages, and Digital Logic Fig 2.14 Two-Way Gated Merge, or Multiplexer Data fro ultiple sources can be selected for transission x x G x y x y G y Tie y

65 2-65 Chapter 2 Machines, Machine Languages, and Digital Logic Fig 2.15 Basic Multiplexer and Sybol Abbreviation An n-way gated erge An n-way ultiplexer with decoder D 0 G 0 D 0 D 1 D 1 G 1 D n 1 D n 1 G n 1 k Select (a) Multiplexer in ters of gates (b) Sybol abbreviation Multiplexer gate signals G i ay be produced by a binary to one-out-of-n decoder

66 2-66 Chapter 2 Machines, Machine Languages, and Digital Logic Fig 2.16 Separating Merged Data x y x 0 G x Tie Merged data can be separated by gating at the right tie It can also be strobed into a flip-flop when valid

67 2-67 Chapter 2 Machines, Machine Languages, and Digital Logic Fig 2.17 Multiplexed Register Transfers Using Gates and Strobes D Q D Q Hold tie C A Q S A Q G C G C D Q D Q S B D B Q S B Q Propagation tie G D Gates Strobes Selected gate and strobe deterine which RT A C and B C can occur together, but not A C and B D

68 2-68 Chapter 2 Machines, Machine Languages, and Digital Logic Fig 2.18 Open-Collector NAND Gate Output Circuit +V Inputs Output 0v 0v +V 0v +V 0v Open Open Open (Out = +V) (Out = +V) (Out = +V) +V +V Out o.c. +V +V Closed (Out = 0v) (a) Open-collector NAND truth table (b) Open-collector NAND (c) Sybol

69 2-69 Chapter 2 Machines, Machine Languages, and Digital Logic Fig 2.19 Wired AND Connection of Open-Collector Gates +V +V a Out b o.c. o.c. (a) Wired AND connection (b) With sybols a Switch b Wired AND output Closed(0) Closed(0) Open (1) Open (1) Closed(0) Open (1) Closed(0) Open (1) (c) Truth table 0v (0) 0v (0) 0v (0) +V (1)

70 2-70 Chapter 2 Machines, Machine Languages, and Digital Logic Fig 2.20 Open-Collector Wired OR Bus DeMorgan s OR by not of AND of NOTS Pull-up resistor reoved fro each gate - open collector One pull-up resistor for whole bus Fors an OR distributed over the connection +V D 0 D 1 D n 1 G 0 o.c. o.c. o.c. G 1 G n 1

71 2-71 Chapter 2 Machines, Machine Languages, and Digital Logic Fig 2.21 Tri-State Gate Internal Structure and Sybol +V Data Out Data Tri- state Out Enable Enable (a) Tri-state gate structure (b) Tri-state gate sybol Enable Data Output Hi-Z Hi-Z 0 1 (c) Tri-state gate truth table

72 2-72 Chapter 2 Machines, Machine Languages, and Digital Logic Fig 2.22 Registers Connected by a Tri-State Bus D R[0] Q D R[1] Q D Q R[n 1] S 0 Q G 0 S 1 Q G 1 S n 1 Q G n 1 Tri-state bus Can ake any register transfer R[i] R[j] Can t have G i = G j = 1 for i j Violating this constraint gives low resistance path fro power supply to ground with predictable results!

73 2-73 Chapter 2 Machines, Machine Languages, and Digital Logic Fig 2.23 Registers and Arithetic Units Connected by One Bus Exaple: Abstract RTN R[3] R[1]+R[2]; R[0] in D Q R[0] Q R[0] out Increenter Q D Concrete RTN Y R[2]; Z R[1]+Y; R[3] Z; R[1] in D Q R[1] Q R[1] out W W out Q D Q Y Y in Q W in Cobinational logic no eory Control Sequence R[2] out, Y in ; R[1] out, Z in ; Z out, R[3] in ; D Q R[n 1] Adder Q D Z R[n 1] in Q R[n 1] out Z out Q Z in Notice that what could be described in one step in the abstract RTN took three steps on this particular hardware

74 2-74 Chapter 2 Machines, Machine Languages, and Digital Logic RTs Possible with the One-Bus Structure R[i] or Y can get the contents of anything but Y Since result different fro operand, it cannot go on the bus that is carrying the operand Arithetic units thus have result registers Only one of two operands can be on the bus at a tie, so adder has register for one operand R[i] R[j] + R[k] is perfored in 3 steps: Y R[k]; Z R[j] + Y; R[i] Z; R[i] R[j] + R[k] is high level RTN description Y R[k]; Z R[j] + Y; R[i] Z; is concrete RTN Map to control sequence is: R[2] out, Y in ; R[1] out, Z in ; Z out, R[3] in ;

75 2-75 Chapter 2 Machines, Machine Languages, and Digital Logic Fro Abstract RTN to Concrete RTN to Control Sequences The ability to begin with an abstract description, then describe a hardware design and resulting concrete RTN and control sequence is powerful. We shall use this ethod in Chapter 4 to develop various hardware designs for SRC.

76 2-76 Chapter 2 Machines, Machine Languages, and Digital Logic Chapter 2 Suary Classes of coputer ISAs Meory addressing odes SRC: a coplete exaple ISA RTN as a description ethod for ISAs RTN description of addressing odes Ipleentation of RTN operations with digital logic circuits Gates, strobes, and ultiplexers

Chapter 2 Topics. 2.1 Classification of Computers & Instructions 2.2 Classes of Instruction Sets 2.3 Informal Description of Simple RISC Computer, SRC

Chapter 2 Topics. 2.1 Classification of Computers & Instructions 2.2 Classes of Instruction Sets 2.3 Informal Description of Simple RISC Computer, SRC Chapter 2 Topics 2.1 Classification of Computers & Instructions 2.2 Classes of Instruction Sets 2.3 Informal Description of Simple RISC Computer, SRC See Appendix C for Assembly language information. 2.4

More information

Instruction Set Architecture. or How to talk to computers if you aren t in Star Trek

Instruction Set Architecture. or How to talk to computers if you aren t in Star Trek Instruction Set Architecture or How to talk to computers if you aren t in Star Trek The Instruction Set Architecture Application Compiler Instr. Set Proc. Operating System I/O system Instruction Set Architecture

More information

Advanced Computer Architecture-CS501. Computer Systems Design and Architecture 2.1, 2.2, 3.2

Advanced Computer Architecture-CS501. Computer Systems Design and Architecture 2.1, 2.2, 3.2 Lecture Handout Computer Architecture Lecture No. 2 Reading Material Vincent P. Heuring&Harry F. Jordan Chapter 2,Chapter3 Computer Systems Design and Architecture 2.1, 2.2, 3.2 Summary 1) A taxonomy of

More information

Instruction Set Design

Instruction Set Design Instruction Set Design Instruction Set Architecture: to what purpose? ISA provides the level of abstraction between the software and the hardware One of the most important abstraction in CS It s narrow,

More information

Computer Organization and Architecture

Computer Organization and Architecture Computer Organization and Architecture Chapter 11 Instruction Sets: Addressing Modes and Formats Instruction Set Design One goal of instruction set design is to minimize instruction length Another goal

More information

Instruction Set Architecture (ISA)

Instruction Set Architecture (ISA) Instruction Set Architecture (ISA) * Instruction set architecture of a machine fills the semantic gap between the user and the machine. * ISA serves as the starting point for the design of a new machine

More information

Instruction Set Architecture

Instruction Set Architecture Instruction Set Architecture Consider x := y+z. (x, y, z are memory variables) 1-address instructions 2-address instructions LOAD y (r :=y) ADD y,z (y := y+z) ADD z (r:=r+z) MOVE x,y (x := y) STORE x (x:=r)

More information

Computer organization

Computer organization Computer organization Computer design an application of digital logic design procedures Computer = processing unit + memory system Processing unit = control + datapath Control = finite state machine inputs

More information

Review: MIPS Addressing Modes/Instruction Formats

Review: MIPS Addressing Modes/Instruction Formats Review: Addressing Modes Addressing mode Example Meaning Register Add R4,R3 R4 R4+R3 Immediate Add R4,#3 R4 R4+3 Displacement Add R4,1(R1) R4 R4+Mem[1+R1] Register indirect Add R4,(R1) R4 R4+Mem[R1] Indexed

More information

Computer Systems Design and Architecture by V. Heuring and H. Jordan

Computer Systems Design and Architecture by V. Heuring and H. Jordan 1-1 Chapter 1 - The General Purpose Machine Computer Systems Design and Architecture Vincent P. Heuring and Harry F. Jordan Department of Electrical and Computer Engineering University of Colorado - Boulder

More information

(Refer Slide Time: 00:01:16 min)

(Refer Slide Time: 00:01:16 min) Digital Computer Organization Prof. P. K. Biswas Department of Electronic & Electrical Communication Engineering Indian Institute of Technology, Kharagpur Lecture No. # 04 CPU Design: Tirning & Control

More information

8085 INSTRUCTION SET

8085 INSTRUCTION SET DATA TRANSFER INSTRUCTIONS Opcode Operand Description 8085 INSTRUCTION SET INSTRUCTION DETAILS Copy from source to destination OV Rd, Rs This instruction copies the contents of the source, Rs register

More information

150127-Microprocessor & Assembly Language

150127-Microprocessor & Assembly Language Chapter 3 Z80 Microprocessor Architecture The Z 80 is one of the most talented 8 bit microprocessors, and many microprocessor-based systems are designed around the Z80. The Z80 microprocessor needs an

More information

MICROPROCESSOR AND MICROCOMPUTER BASICS

MICROPROCESSOR AND MICROCOMPUTER BASICS Introduction MICROPROCESSOR AND MICROCOMPUTER BASICS At present there are many types and sizes of computers available. These computers are designed and constructed based on digital and Integrated Circuit

More information

Chapter 2 Logic Gates and Introduction to Computer Architecture

Chapter 2 Logic Gates and Introduction to Computer Architecture Chapter 2 Logic Gates and Introduction to Computer Architecture 2.1 Introduction The basic components of an Integrated Circuit (IC) is logic gates which made of transistors, in digital system there are

More information

1 Classical Universal Computer 3

1 Classical Universal Computer 3 Chapter 6: Machine Language and Assembler Christian Jacob 1 Classical Universal Computer 3 1.1 Von Neumann Architecture 3 1.2 CPU and RAM 5 1.3 Arithmetic Logical Unit (ALU) 6 1.4 Arithmetic Logical Unit

More information

A single register, called the accumulator, stores the. operand before the operation, and stores the result. Add y # add y from memory to the acc

A single register, called the accumulator, stores the. operand before the operation, and stores the result. Add y # add y from memory to the acc Other architectures Example. Accumulator-based machines A single register, called the accumulator, stores the operand before the operation, and stores the result after the operation. Load x # into acc

More information

LSN 2 Computer Processors

LSN 2 Computer Processors LSN 2 Computer Processors Department of Engineering Technology LSN 2 Computer Processors Microprocessors Design Instruction set Processor organization Processor performance Bandwidth Clock speed LSN 2

More information

Instruction Set Architecture (ISA) Design. Classification Categories

Instruction Set Architecture (ISA) Design. Classification Categories Instruction Set Architecture (ISA) Design Overview» Classify Instruction set architectures» Look at how applications use ISAs» Examine a modern RISC ISA (DLX)» Measurement of ISA usage in real computers

More information

PART B QUESTIONS AND ANSWERS UNIT I

PART B QUESTIONS AND ANSWERS UNIT I PART B QUESTIONS AND ANSWERS UNIT I 1. Explain the architecture of 8085 microprocessor? Logic pin out of 8085 microprocessor Address bus: unidirectional bus, used as high order bus Data bus: bi-directional

More information

MACHINE INSTRUCTIONS AND PROGRAMS

MACHINE INSTRUCTIONS AND PROGRAMS CHAPTER 2 MACHINE INSTRUCTIONS AND PROGRAMS CHAPTER OBJECTIVES In this chapter you will learn about: Machine instructions and program execution, including branching and subroutine call and return operations

More information

BASIC COMPUTER ORGANIZATION AND DESIGN

BASIC COMPUTER ORGANIZATION AND DESIGN 1 BASIC COMPUTER ORGANIZATION AND DESIGN Instruction Codes Computer Registers Computer Instructions Timing and Control Instruction Cycle Memory Reference Instructions Input-Output and Interrupt Complete

More information

RISC Processor Simulator (SRC) INEL 4215: Computer Architecture and Organization September 22, 2004

RISC Processor Simulator (SRC) INEL 4215: Computer Architecture and Organization September 22, 2004 General Project Description RISC Processor Simulator (SRC) INEL 4215: Computer Architecture and Organization September 22, 2004 In the textbook, Computer Systems Design and Architecture by Heuring, we

More information

Reduced Instruction Set Computer (RISC)

Reduced Instruction Set Computer (RISC) Reduced Instruction Set Computer (RISC) Focuses on reducing the number and complexity of instructions of the ISA. RISC Goals RISC: Simplify ISA Simplify CPU Design Better CPU Performance Motivated by simplifying

More information

MACHINE ARCHITECTURE & LANGUAGE

MACHINE ARCHITECTURE & LANGUAGE in the name of God the compassionate, the merciful notes on MACHINE ARCHITECTURE & LANGUAGE compiled by Jumong Chap. 9 Microprocessor Fundamentals A system designer should consider a microprocessor-based

More information

Let s put together a Manual Processor

Let s put together a Manual Processor Lecture 14 Let s put together a Manual Processor Hardware Lecture 14 Slide 1 The processor Inside every computer there is at least one processor which can take an instruction, some operands and produce

More information

Central Processing Unit (CPU)

Central Processing Unit (CPU) Central Processing Unit (CPU) CPU is the heart and brain It interprets and executes machine level instructions Controls data transfer from/to Main Memory (MM) and CPU Detects any errors In the following

More information

EE282 Computer Architecture and Organization Midterm Exam February 13, 2001. (Total Time = 120 minutes, Total Points = 100)

EE282 Computer Architecture and Organization Midterm Exam February 13, 2001. (Total Time = 120 minutes, Total Points = 100) EE282 Computer Architecture and Organization Midterm Exam February 13, 2001 (Total Time = 120 minutes, Total Points = 100) Name: (please print) Wolfe - Solution In recognition of and in the spirit of the

More information

Systems I: Computer Organization and Architecture

Systems I: Computer Organization and Architecture Systems I: Computer Organization and Architecture Lecture : Microprogrammed Control Microprogramming The control unit is responsible for initiating the sequence of microoperations that comprise instructions.

More information

Calculating the Return on Investment (ROI) for DMSMS Management. The Problem with Cost Avoidance

Calculating the Return on Investment (ROI) for DMSMS Management. The Problem with Cost Avoidance Calculating the Return on nvestent () for DMSMS Manageent Peter Sandborn CALCE, Departent of Mechanical Engineering (31) 45-3167 [email protected] www.ene.ud.edu/escml/obsolescence.ht October 28, 21

More information

Introduction to Unit Conversion: the SI

Introduction to Unit Conversion: the SI The Matheatics 11 Copetency Test Introduction to Unit Conversion: the SI In this the next docuent in this series is presented illustrated an effective reliable approach to carryin out unit conversions

More information

l C-Programming l A real computer language l Data Representation l Everything goes down to bits and bytes l Machine representation Language

l C-Programming l A real computer language l Data Representation l Everything goes down to bits and bytes l Machine representation Language 198:211 Computer Architecture Topics: Processor Design Where are we now? C-Programming A real computer language Data Representation Everything goes down to bits and bytes Machine representation Language

More information

EECS 427 RISC PROCESSOR

EECS 427 RISC PROCESSOR RISC PROCESSOR ISA FOR EECS 427 PROCESSOR ImmHi/ ImmLo/ OP Code Rdest OP Code Ext Rsrc Mnemonic Operands 15-12 11-8 7-4 3-0 Notes (* is Baseline) ADD Rsrc, Rdest 0000 Rdest 0101 Rsrc * ADDI Imm, Rdest

More information

Overview. CISC Developments. RISC Designs. CISC Designs. VAX: Addressing Modes. Digital VAX

Overview. CISC Developments. RISC Designs. CISC Designs. VAX: Addressing Modes. Digital VAX Overview CISC Developments Over Twenty Years Classic CISC design: Digital VAX VAXÕs RISC successor: PRISM/Alpha IntelÕs ubiquitous 80x86 architecture Ð 8086 through the Pentium Pro (P6) RJS 2/3/97 Philosophy

More information

CHAPTER 7: The CPU and Memory

CHAPTER 7: The CPU and Memory CHAPTER 7: The CPU and Memory The Architecture of Computer Hardware, Systems Software & Networking: An Information Technology Approach 4th Edition, Irv Englander John Wiley and Sons 2010 PowerPoint slides

More information

UNIVERSITY OF CALIFORNIA, DAVIS Department of Electrical and Computer Engineering. EEC180B Lab 7: MISP Processor Design Spring 1995

UNIVERSITY OF CALIFORNIA, DAVIS Department of Electrical and Computer Engineering. EEC180B Lab 7: MISP Processor Design Spring 1995 UNIVERSITY OF CALIFORNIA, DAVIS Department of Electrical and Computer Engineering EEC180B Lab 7: MISP Processor Design Spring 1995 Objective: In this lab, you will complete the design of the MISP processor,

More information

Computer Architecture Lecture 2: Instruction Set Principles (Appendix A) Chih Wei Liu 劉 志 尉 National Chiao Tung University [email protected].

Computer Architecture Lecture 2: Instruction Set Principles (Appendix A) Chih Wei Liu 劉 志 尉 National Chiao Tung University cwliu@twins.ee.nctu.edu. Computer Architecture Lecture 2: Instruction Set Principles (Appendix A) Chih Wei Liu 劉 志 尉 National Chiao Tung University [email protected] Review Computers in mid 50 s Hardware was expensive

More information

An Introduction to the ARM 7 Architecture

An Introduction to the ARM 7 Architecture An Introduction to the ARM 7 Architecture Trevor Martin CEng, MIEE Technical Director This article gives an overview of the ARM 7 architecture and a description of its major features for a developer new

More information

Chapter 9 Computer Design Basics!

Chapter 9 Computer Design Basics! Logic and Computer Design Fundamentals Chapter 9 Computer Design Basics! Part 2 A Simple Computer! Charles Kime & Thomas Kaminski 2008 Pearson Education, Inc. (Hyperlinks are active in View Show mode)

More information

Chapter 5 Instructor's Manual

Chapter 5 Instructor's Manual The Essentials of Computer Organization and Architecture Linda Null and Julia Lobur Jones and Bartlett Publishers, 2003 Chapter 5 Instructor's Manual Chapter Objectives Chapter 5, A Closer Look at Instruction

More information

ON SELF-ROUTING IN CLOS CONNECTION NETWORKS. BARRY G. DOUGLASS Electrical Engineering Department Texas A&M University College Station, TX 77843-3128

ON SELF-ROUTING IN CLOS CONNECTION NETWORKS. BARRY G. DOUGLASS Electrical Engineering Department Texas A&M University College Station, TX 77843-3128 ON SELF-ROUTING IN CLOS CONNECTION NETWORKS BARRY G. DOUGLASS Electrical Engineering Departent Texas A&M University College Station, TX 778-8 A. YAVUZ ORUÇ Electrical Engineering Departent and Institute

More information

CPU Organization and Assembly Language

CPU Organization and Assembly Language COS 140 Foundations of Computer Science School of Computing and Information Science University of Maine October 2, 2015 Outline 1 2 3 4 5 6 7 8 Homework and announcements Reading: Chapter 12 Homework:

More information

CS101 Lecture 26: Low Level Programming. John Magee 30 July 2013 Some material copyright Jones and Bartlett. Overview/Questions

CS101 Lecture 26: Low Level Programming. John Magee 30 July 2013 Some material copyright Jones and Bartlett. Overview/Questions CS101 Lecture 26: Low Level Programming John Magee 30 July 2013 Some material copyright Jones and Bartlett 1 Overview/Questions What did we do last time? How can we control the computer s circuits? How

More information

İSTANBUL AYDIN UNIVERSITY

İSTANBUL AYDIN UNIVERSITY İSTANBUL AYDIN UNIVERSITY FACULTY OF ENGİNEERİNG SOFTWARE ENGINEERING THE PROJECT OF THE INSTRUCTION SET COMPUTER ORGANIZATION GÖZDE ARAS B1205.090015 Instructor: Prof. Dr. HASAN HÜSEYİN BALIK DECEMBER

More information

M A S S A C H U S E T T S I N S T I T U T E O F T E C H N O L O G Y DEPARTMENT OF ELECTRICAL ENGINEERING AND COMPUTER SCIENCE

M A S S A C H U S E T T S I N S T I T U T E O F T E C H N O L O G Y DEPARTMENT OF ELECTRICAL ENGINEERING AND COMPUTER SCIENCE M A S S A C H U S E T T S I N S T I T U T E O F T E C H N O L O G Y DEPARTMENT OF ELECTRICAL ENGINEERING AND COMPUTER SCIENCE 1. Introduction 6.004 Computation Structures β Documentation This handout is

More information

EC 362 Problem Set #2

EC 362 Problem Set #2 EC 362 Problem Set #2 1) Using Single Precision IEEE 754, what is FF28 0000? 2) Suppose the fraction enhanced of a processor is 40% and the speedup of the enhancement was tenfold. What is the overall speedup?

More information

CHAPTER 4 MARIE: An Introduction to a Simple Computer

CHAPTER 4 MARIE: An Introduction to a Simple Computer CHAPTER 4 MARIE: An Introduction to a Simple Computer 4.1 Introduction 195 4.2 CPU Basics and Organization 195 4.2.1 The Registers 196 4.2.2 The ALU 197 4.2.3 The Control Unit 197 4.3 The Bus 197 4.4 Clocks

More information

Chapter 4 Register Transfer and Microoperations. Section 4.1 Register Transfer Language

Chapter 4 Register Transfer and Microoperations. Section 4.1 Register Transfer Language Chapter 4 Register Transfer and Microoperations Section 4.1 Register Transfer Language Digital systems are composed of modules that are constructed from digital components, such as registers, decoders,

More information

what operations can it perform? how does it perform them? on what kind of data? where are instructions and data stored?

what operations can it perform? how does it perform them? on what kind of data? where are instructions and data stored? Inside the CPU how does the CPU work? what operations can it perform? how does it perform them? on what kind of data? where are instructions and data stored? some short, boring programs to illustrate the

More information

Intel 8086 architecture

Intel 8086 architecture Intel 8086 architecture Today we ll take a look at Intel s 8086, which is one of the oldest and yet most prevalent processor architectures around. We ll make many comparisons between the MIPS and 8086

More information

The AVR Microcontroller and C Compiler Co-Design Dr. Gaute Myklebust ATMEL Corporation ATMEL Development Center, Trondheim, Norway

The AVR Microcontroller and C Compiler Co-Design Dr. Gaute Myklebust ATMEL Corporation ATMEL Development Center, Trondheim, Norway The AVR Microcontroller and C Compiler Co-Design Dr. Gaute Myklebust ATMEL Corporation ATMEL Development Center, Trondheim, Norway Abstract High Level Languages (HLLs) are rapidly becoming the standard

More information

Faculty of Engineering Student Number:

Faculty of Engineering Student Number: Philadelphia University Student Name: Faculty of Engineering Student Number: Dept. of Computer Engineering Final Exam, First Semester: 2012/2013 Course Title: Microprocessors Date: 17/01//2013 Course No:

More information

The 104 Duke_ACC Machine

The 104 Duke_ACC Machine The 104 Duke_ACC Machine The goal of the next two lessons is to design and simulate a simple accumulator-based processor. The specifications for this processor and some of the QuartusII design components

More information

18-447 Computer Architecture Lecture 3: ISA Tradeoffs. Prof. Onur Mutlu Carnegie Mellon University Spring 2013, 1/18/2013

18-447 Computer Architecture Lecture 3: ISA Tradeoffs. Prof. Onur Mutlu Carnegie Mellon University Spring 2013, 1/18/2013 18-447 Computer Architecture Lecture 3: ISA Tradeoffs Prof. Onur Mutlu Carnegie Mellon University Spring 2013, 1/18/2013 Reminder: Homeworks for Next Two Weeks Homework 0 Due next Wednesday (Jan 23), right

More information

Presentation Safety Legislation and Standards

Presentation Safety Legislation and Standards levels in different discrete levels corresponding for each one to a probability of dangerous failure per hour: > > The table below gives the relationship between the perforance level (PL) and the Safety

More information

Online Bagging and Boosting

Online Bagging and Boosting Abstract Bagging and boosting are two of the ost well-known enseble learning ethods due to their theoretical perforance guarantees and strong experiental results. However, these algoriths have been used

More information

Lecture 7: Machine-Level Programming I: Basics Mohamed Zahran (aka Z) [email protected] http://www.mzahran.com

Lecture 7: Machine-Level Programming I: Basics Mohamed Zahran (aka Z) mzahran@cs.nyu.edu http://www.mzahran.com CSCI-UA.0201-003 Computer Systems Organization Lecture 7: Machine-Level Programming I: Basics Mohamed Zahran (aka Z) [email protected] http://www.mzahran.com Some slides adapted (and slightly modified)

More information

Outline. Lecture 3. Basics. Logical vs. physical memory. 8086 physical memory. x86 byte ordering

Outline. Lecture 3. Basics. Logical vs. physical memory. 8086 physical memory. x86 byte ordering Outline Lecture 3 bout Memory ddressing memory Data types MOV instruction ddressing modes Instruction format Dr. Dimitrios S. Nikolopoulos SL/UIU Basics Logical vs. physical memory Memory in the x processors

More information

MICROPROCESSOR. Exclusive for IACE Students www.iace.co.in iacehyd.blogspot.in Ph: 9700077455/422 Page 1

MICROPROCESSOR. Exclusive for IACE Students www.iace.co.in iacehyd.blogspot.in Ph: 9700077455/422 Page 1 MICROPROCESSOR A microprocessor incorporates the functions of a computer s central processing unit (CPU) on a single Integrated (IC), or at most a few integrated circuit. It is a multipurpose, programmable

More information

Addressing The problem. When & Where do we encounter Data? The concept of addressing data' in computations. The implications for our machine design(s)

Addressing The problem. When & Where do we encounter Data? The concept of addressing data' in computations. The implications for our machine design(s) Addressing The problem Objectives:- When & Where do we encounter Data? The concept of addressing data' in computations The implications for our machine design(s) Introducing the stack-machine concept Slide

More information

Pipeline Hazards. Structure hazard Data hazard. ComputerArchitecture_PipelineHazard1

Pipeline Hazards. Structure hazard Data hazard. ComputerArchitecture_PipelineHazard1 Pipeline Hazards Structure hazard Data hazard Pipeline hazard: the major hurdle A hazard is a condition that prevents an instruction in the pipe from executing its next scheduled pipe stage Taxonomy of

More information

2. FINDING A SOLUTION

2. FINDING A SOLUTION The 7 th Balan Conference on Operational Research BACOR 5 Constanta, May 5, Roania OPTIMAL TIME AND SPACE COMPLEXITY ALGORITHM FOR CONSTRUCTION OF ALL BINARY TREES FROM PRE-ORDER AND POST-ORDER TRAVERSALS

More information

Implementation of Active Queue Management in a Combined Input and Output Queued Switch

Implementation of Active Queue Management in a Combined Input and Output Queued Switch pleentation of Active Queue Manageent in a obined nput and Output Queued Switch Bartek Wydrowski and Moshe Zukeran AR Special Research entre for Ultra-Broadband nforation Networks, EEE Departent, The University

More information

Design of Model Reference Self Tuning Mechanism for PID like Fuzzy Controller

Design of Model Reference Self Tuning Mechanism for PID like Fuzzy Controller Research Article International Journal of Current Engineering and Technology EISSN 77 46, PISSN 347 56 4 INPRESSCO, All Rights Reserved Available at http://inpressco.co/category/ijcet Design of Model Reference

More information

PROBLEMS (Cap. 4 - Istruzioni macchina)

PROBLEMS (Cap. 4 - Istruzioni macchina) 98 CHAPTER 2 MACHINE INSTRUCTIONS AND PROGRAMS PROBLEMS (Cap. 4 - Istruzioni macchina) 2.1 Represent the decimal values 5, 2, 14, 10, 26, 19, 51, and 43, as signed, 7-bit numbers in the following binary

More information

Reliability Constrained Packet-sizing for Linear Multi-hop Wireless Networks

Reliability Constrained Packet-sizing for Linear Multi-hop Wireless Networks Reliability Constrained acket-sizing for inear Multi-hop Wireless Networks Ning Wen, and Randall A. Berry Departent of Electrical Engineering and Coputer Science Northwestern University, Evanston, Illinois

More information

a storage location directly on the CPU, used for temporary storage of small amounts of data during processing.

a storage location directly on the CPU, used for temporary storage of small amounts of data during processing. CS143 Handout 18 Summer 2008 30 July, 2008 Processor Architectures Handout written by Maggie Johnson and revised by Julie Zelenski. Architecture Vocabulary Let s review a few relevant hardware definitions:

More information

Chapter 4 Lecture 5 The Microarchitecture Level Integer JAVA Virtual Machine

Chapter 4 Lecture 5 The Microarchitecture Level Integer JAVA Virtual Machine Chapter 4 Lecture 5 The Microarchitecture Level Integer JAVA Virtual Machine This is a limited version of a hardware implementation to execute the JAVA programming language. 1 of 23 Structured Computer

More information

CPU Animation. Introduction. CPU skinning. CPUSkin Scalar:

CPU Animation. Introduction. CPU skinning. CPUSkin Scalar: CPU Aniation Introduction The iportance of real-tie character aniation has greatly increased in odern gaes. Aniating eshes ia 'skinning' can be perfored on both a general purpose CPU and a ore specialized

More information

Summary of the MARIE Assembly Language

Summary of the MARIE Assembly Language Supplement for Assignment # (sections.8 -. of the textbook) Summary of the MARIE Assembly Language Type of Instructions Arithmetic Data Transfer I/O Branch Subroutine call and return Mnemonic ADD X SUBT

More information

How To Get A Loan From A Bank For Free

How To Get A Loan From A Bank For Free Finance 111 Finance We have to work with oney every day. While balancing your checkbook or calculating your onthly expenditures on espresso requires only arithetic, when we start saving, planning for retireent,

More information

BCD (ASCII) Arithmetic. Where and Why is BCD used? Packed BCD, ASCII, Unpacked BCD. BCD Adjustment Instructions AAA. Example

BCD (ASCII) Arithmetic. Where and Why is BCD used? Packed BCD, ASCII, Unpacked BCD. BCD Adjustment Instructions AAA. Example BCD (ASCII) Arithmetic We will first look at unpacked BCD which means strings that look like '4567'. Bytes then look like 34h 35h 36h 37h OR: 04h 05h 06h 07h x86 processors also have instructions for packed

More information

Notes on Assembly Language

Notes on Assembly Language Notes on Assembly Language Brief introduction to assembly programming The main components of a computer that take part in the execution of a program written in assembly code are the following: A set of

More information

Machine Learning Applications in Grid Computing

Machine Learning Applications in Grid Computing Machine Learning Applications in Grid Coputing George Cybenko, Guofei Jiang and Daniel Bilar Thayer School of Engineering Dartouth College Hanover, NH 03755, USA [email protected], [email protected]

More information

A s we saw in Chapter 4, a CPU contains three main sections: the register section,

A s we saw in Chapter 4, a CPU contains three main sections: the register section, 6 CPU Design A s we saw in Chapter 4, a CPU contains three main sections: the register section, the arithmetic/logic unit (ALU), and the control unit. These sections work together to perform the sequences

More information

Lecture L9 - Linear Impulse and Momentum. Collisions

Lecture L9 - Linear Impulse and Momentum. Collisions J. Peraire, S. Widnall 16.07 Dynaics Fall 009 Version.0 Lecture L9 - Linear Ipulse and Moentu. Collisions In this lecture, we will consider the equations that result fro integrating Newton s second law,

More information

Applying Multiple Neural Networks on Large Scale Data

Applying Multiple Neural Networks on Large Scale Data 0 International Conference on Inforation and Electronics Engineering IPCSIT vol6 (0) (0) IACSIT Press, Singapore Applying Multiple Neural Networks on Large Scale Data Kritsanatt Boonkiatpong and Sukree

More information

Digital Logic Design. Basics Combinational Circuits Sequential Circuits. Pu-Jen Cheng

Digital Logic Design. Basics Combinational Circuits Sequential Circuits. Pu-Jen Cheng Digital Logic Design Basics Combinational Circuits Sequential Circuits Pu-Jen Cheng Adapted from the slides prepared by S. Dandamudi for the book, Fundamentals of Computer Organization and Design. Introduction

More information

An Introduction to Assembly Programming with the ARM 32-bit Processor Family

An Introduction to Assembly Programming with the ARM 32-bit Processor Family An Introduction to Assembly Programming with the ARM 32-bit Processor Family G. Agosta Politecnico di Milano December 3, 2011 Contents 1 Introduction 1 1.1 Prerequisites............................. 2

More information

Translating C code to MIPS

Translating C code to MIPS Translating C code to MIPS why do it C is relatively simple, close to the machine C can act as pseudocode for assembler program gives some insight into what compiler needs to do what's under the hood do

More information

CPU Organisation and Operation

CPU Organisation and Operation CPU Organisation and Operation The Fetch-Execute Cycle The operation of the CPU 1 is usually described in terms of the Fetch-Execute cycle. 2 Fetch-Execute Cycle Fetch the Instruction Increment the Program

More information

Z80 Instruction Set. Z80 Assembly Language

Z80 Instruction Set. Z80 Assembly Language 75 Z80 Assembly Language The assembly language allows the user to write a program without concern for memory addresses or machine instruction formats. It uses symbolic addresses to identify memory locations

More information

Programmer s Model = model of µc useful to view hardware during execution of software instructions

Programmer s Model = model of µc useful to view hardware during execution of software instructions HC12/S12 Programmer s Model Programmer s Model = model of µc useful to view hardware during execution of software instructions Recall: General Microcontroller/Computer Architecture note: Control Unit &

More information

Systems I: Computer Organization and Architecture

Systems I: Computer Organization and Architecture Systems I: Computer Organization and Architecture Lecture 9 - Register Transfer and Microoperations Microoperations Digital systems are modular in nature, with modules containing registers, decoders, arithmetic

More information

Exercise 4 INVESTIGATION OF THE ONE-DEGREE-OF-FREEDOM SYSTEM

Exercise 4 INVESTIGATION OF THE ONE-DEGREE-OF-FREEDOM SYSTEM Eercise 4 IVESTIGATIO OF THE OE-DEGREE-OF-FREEDOM SYSTEM 1. Ai of the eercise Identification of paraeters of the euation describing a one-degree-of- freedo (1 DOF) atheatical odel of the real vibrating

More information

THUMB Instruction Set

THUMB Instruction Set 5 THUMB Instruction Set This chapter describes the THUMB instruction set. Format Summary 5-2 Opcode Summary 5-3 5. Format : move shifted register 5-5 5.2 Format 2: add/subtract 5-7 5.3 Format 3: move/compare/add/subtract

More information

How It All Works. Other M68000 Updates. Basic Control Signals. Basic Control Signals

How It All Works. Other M68000 Updates. Basic Control Signals. Basic Control Signals CPU Architectures Motorola 68000 Several CPU architectures exist currently: Motorola Intel AMD (Advanced Micro Devices) PowerPC Pick one to study; others will be variations on this. Arbitrary pick: Motorola

More information

RECURSIVE DYNAMIC PROGRAMMING: HEURISTIC RULES, BOUNDING AND STATE SPACE REDUCTION. Henrik Kure

RECURSIVE DYNAMIC PROGRAMMING: HEURISTIC RULES, BOUNDING AND STATE SPACE REDUCTION. Henrik Kure RECURSIVE DYNAMIC PROGRAMMING: HEURISTIC RULES, BOUNDING AND STATE SPACE REDUCTION Henrik Kure Dina, Danish Inforatics Network In the Agricultural Sciences Royal Veterinary and Agricultural University

More information

Administrative Issues

Administrative Issues CSC 3210 Computer Organization and Programming Introduction and Overview Dr. Anu Bourgeois (modified by Yuan Long) Administrative Issues Required Prerequisites CSc 2010 Intro to CSc CSc 2310 Java Programming

More information

CPU Performance Equation

CPU Performance Equation CPU Performance Equation C T I T ime for task = C T I =Average # Cycles per instruction =Time per cycle =Instructions per task Pipelining e.g. 3-5 pipeline steps (ARM, SA, R3000) Attempt to get C down

More information

OAMulator. Online One Address Machine emulator and OAMPL compiler. http://myspiders.biz.uiowa.edu/~fil/oam/

OAMulator. Online One Address Machine emulator and OAMPL compiler. http://myspiders.biz.uiowa.edu/~fil/oam/ OAMulator Online One Address Machine emulator and OAMPL compiler http://myspiders.biz.uiowa.edu/~fil/oam/ OAMulator educational goals OAM emulator concepts Von Neumann architecture Registers, ALU, controller

More information

WAR: Write After Read

WAR: Write After Read WAR: Write After Read write-after-read (WAR) = artificial (name) dependence add R1, R2, R3 sub R2, R4, R1 or R1, R6, R3 problem: add could use wrong value for R2 can t happen in vanilla pipeline (reads

More information

8-Bit Flash Microcontroller for Smart Cards. AT89SCXXXXA Summary. Features. Description. Complete datasheet available under NDA

8-Bit Flash Microcontroller for Smart Cards. AT89SCXXXXA Summary. Features. Description. Complete datasheet available under NDA Features Compatible with MCS-51 products On-chip Flash Program Memory Endurance: 1,000 Write/Erase Cycles On-chip EEPROM Data Memory Endurance: 100,000 Write/Erase Cycles 512 x 8-bit RAM ISO 7816 I/O Port

More information

CSE 141 Introduction to Computer Architecture Summer Session I, 2005. Lecture 1 Introduction. Pramod V. Argade June 27, 2005

CSE 141 Introduction to Computer Architecture Summer Session I, 2005. Lecture 1 Introduction. Pramod V. Argade June 27, 2005 CSE 141 Introduction to Computer Architecture Summer Session I, 2005 Lecture 1 Introduction Pramod V. Argade June 27, 2005 CSE141: Introduction to Computer Architecture Instructor: Pramod V. Argade ([email protected])

More information

An Innovate Dynamic Load Balancing Algorithm Based on Task

An Innovate Dynamic Load Balancing Algorithm Based on Task An Innovate Dynaic Load Balancing Algorith Based on Task Classification Hong-bin Wang,,a, Zhi-yi Fang, b, Guan-nan Qu,*,c, Xiao-dan Ren,d College of Coputer Science and Technology, Jilin University, Changchun

More information

Take-Home Exercise. z y x. Erik Jonsson School of Engineering and Computer Science. The University of Texas at Dallas

Take-Home Exercise. z y x. Erik Jonsson School of Engineering and Computer Science. The University of Texas at Dallas Take-Home Exercise Assume you want the counter below to count mod-6 backward. That is, it would count 0-5-4-3-2-1-0, etc. Assume it is reset on startup, and design the wiring to make the counter count

More information

CSE 141L Computer Architecture Lab Fall 2003. Lecture 2

CSE 141L Computer Architecture Lab Fall 2003. Lecture 2 CSE 141L Computer Architecture Lab Fall 2003 Lecture 2 Pramod V. Argade CSE141L: Computer Architecture Lab Instructor: TA: Readers: Pramod V. Argade ([email protected]) Office Hour: Tue./Thu. 9:30-10:30

More information