Chapter 4 Lecture 3 The Microarchitecture Level Integer JAVA Virtual Machine

Size: px
Start display at page:

Download "Chapter 4 Lecture 3 The Microarchitecture Level Integer JAVA Virtual Machine"

Transcription

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

2 Review The Data Path Register structure The ALU and ALU available operations Data Path Clocking and Timing External Memory Operation Two separate memory ports, one for data and one for instructions) Reading memories (Cycle latency delays) Reading followed by write memories (Cycle latency delays) Microinstructions Each JAVA instruction is translated or expanded into a sequence of microinstructions that require multiple clock cycles to execute. M or MicroProgram Counter: Internal microcode address register MIR or IR Microinstruction Register: Internal instruction used to control the IJVM Elements of the microinstructions (All instructions whether explicit or implicit): Operands what is the operand that goes on the B Bus Execution what ALU and shift operation is to occur Results where are the execution results to be stored from the C Bus and does it involve memory operations Program Control where is the next instruction determined MicroInstructions Elements 2 of 30

3 MIR Content The MIR Fields: B Bus, ALU & Shift, C Bus and Ext. Mem., Next M B Field: Encoded selection of register file output to B Bus Mem Field: External memory control selection for data and instructions C Field: Bit selection of which registers to write from the C Bus ALU Field: Control bits for the ALU and Shift execution elements JAM: Microprogram control flow bits; allow branching, explicitly or in new instructions Addr: The address to be combined to create the M and define the next Microinstruction Encoded B-Bus Selection with a 4:16 Decoder B-Bus Instruction Field B-Bus Register Selected 0000 MDR MBR (signed) 0011 MBRU (unsigned) 0100 SP 0101 LV 0110 CPP 0111 TOS 1000 O 1001 Unassigned 1010 Unassigned 1011 Unassigned 1100 Unassigned 1101 Unassigned 1110 Unassigned 1111 Unassigned 3 of 30

4 IJVM Programmer s Model and Organization Method Area Constant Pool Local Variable Frame Operand Stack External Program Memory containing the IJVM program to be executed. The internal is a pointer in the Method Area to the next instruction to be executed. The method area is accessed using the with 8-bit instructions and parameters loaded into the MBR. External Data Memory containing compiled constants (e.g. values, strings, pointers, etc.) required by the Methods to execute programs. External Data Memory allocated for the storage of variables for the method being executed. When a method is invoked, a local variable frame of predefined size is established (allocated) for all local variables used by the method External Data Memory used for the storage of temporary operands that are placed on the stack. The Operand Stack maximum size is known when a Method is invoked. This allows proper memory allocation and deallocation. 4 of 30

5 Simplified Example of Local Variable Frames Figure 4-8. Use of a stack for storing local variables. (a) While A is active. (b) After A calls B. (c) After B calls C. (d) After C and B return and A calls D. Process A Active Process A Calls Process B; Process B has 4 local variables Process B Calls Process C; Process C has 2 local variables Process C Completes and returns to B Process B Completes and returns to A Process A Calls Process D; Process D has 5 local variables 5 of 30

6 IJVM s JAVA Instruction Set Architecture (p. 250) IJVM s JAVA Instruction Set Hex Mnemonic Meaning Basic Stack Operations Data Movement Instructions 0x10 BIPUSH byte Push byte onto stack 0x13 LDC_W index Push constant from constant pool onto stack 0x15 ILOAD varnum Push local variable onto stack 0x36 ISTORE varnum Pop word from stack and store in local variable 0x57 POP Delete word on top of stack 0x59 DUP Copy top word on stack and push onto stack 0x5F SWAP Swap the two top words on the stack Operand Arithmetic ALU Instructions 0x60 IADD Pop two words from stack; push their sum 0x64 ISUB Pop two words from stack; push their difference 0x7E IAND Pop two words from stack; push Boolean AND 0x80 IOR Pop two words from stack; push Boolean OR 0x84 IINC varnum const Add a constant to a local variable Branching Flow Control Instructions 0x99 IFEQ offset Pop word from stack and branch if it is zero 0x9B IFLT offset Pop word from stack and branch if it is less than zero 0x9F IF_ICMPEQ offset Pop two words from stack; branch if equal 0xA7 GOTO offset Unconditional branch Misc. Other Instructions 0x00 NOP Do nothing 0xC4 WIDE Prefix instruction; next instruction has a 16-bit index Special Operations Subroutine/ISR Control Instructions 0xB6 INVOKEVIRTUAL disp Invoke a method 0xAC IRETURN Return from method with integer value The operands byte, const, and varnum are 1 byte. The operands disp, index, and offset are 2 bytes. 6 of 30

7 Compiling JAVA to IJVM and operating with the stacks (a) A Java fragment. (b) Java assembly language. (c) The IJVM program. LV+3 LV+2 LV+1 LV k j i LV Reference SP TOS=k CPP+3 CPP+2 CPP+1 CPP XXXX XXXX XXXX CPP Ref The initial local variable frame and constant pool The stack after each instruction. (SP address and TOS values change) 7 of 30

8 Implementing IJVM Instructions The microinstructions may be thought of as a micro-assembly language (MAL). The microcode is defined using a symbolic language or pseudo-code that identify every MIR field required for each and every microinstruction. This may be referred to as register transfer notation (RTN) or register transfer language (RTL) The symbolic microcode consists of a label, an operation, and comments. The label is used to assign the address of the microinstruction in the microcode space. The operation field symbolically represents all MIR control functions. The comment field is used to describe the code, machine state, or machine operations. Allowed ALU Operations Source and Destination: any allowable B-bus or C-bus registers in the MIR. Note: this symbolic code defines the A-bus (H Register Value), B-bus, C-bus, and ALU MIR fields. For a complete instruction, we must also include;, memory read or write, the JAMX bits and the next microinstruction field. (all the bits in the MIR!) Illegal Ops: (1) subtraction is SOURCE-H (2) only one value on B-Bus at a time, use H register (3) MAR is not available to the B-Bus (excluded for some reason?) 8 of 30

9 IADD (0x60h) Pop two words from stack; push their sum Instruction Operation Example JAVA: MAL: IADD main1 and iadd1(0x015) to iadd3 Things to do: Increment the to the next instruction and the next instruction. Use the TOS register value (avoid reading the and move it to the H register. Decrement the SP (SP=SP-1), request the data at the new SP (using MAR=SP) and read in the data (to the MDR) at the new SP location. Add the two registered values (H and MDR). Put the result into TOS register and write it to the memory at the new SP address (MDR using MAR=SP). Note: there are memory access delays that must also be accounted for! Label Operations Comments main1 = + 1; ; goto (MBR) MBR holds opcode (0x60h); get next byte; dispatch iadd1 MAR = SP = SP-1; rd Read in next-to-top word on stack iadd2 H = TOS H = top of stack (op theory) iadd3 MDR = TOS = MDR + H; wr; goto main1 Add top two words; write to top of stack main1 = + 1; ; goto (MBR) MBR holds opcode (0x60h); get next byte; dispatch Similar instructions: ISUB, IAND, IOR 9 of 30

10 Executing the JAVA IADD Instruction in Mic-1 Cycle M main1 iadd1 iadd2 iadd3 main1 INST = +1; ; goto (MBR) MAR= SP = SP-1; rd H= TOS MDR= TOS= MDR+H; wr; goto main1 = +1; ; goto (MBR) Next M gt (iadd1) iadd2 iadd3 main1 gt (MBR) +1 MBR IADD=iadd1 INST MAR rd/wr SP-1 rd SP-1 SP-1 wr MDR (@SP-1) MDR+H SP SP SP-1 LV CPP TOS (@SP) MDR+H H TOS (@SP) 10 of 30 Notes and figures are based on or taken from materials in the course textbook: A.S. Tanenbaum, Structured

11 Example: adding TOS with a memory and writing back This is the IADD instruction shown at the clock cycle level. (1) (2) (3) CPU CLK MAR Address Bus MAR SP-1 RD# WR# Memory H H TOS Read Latency Write Latency MAR=SP-1; rd; % read delay of one clock cycle required H=TOS; % use delay to load H register MDR=H+MDR; wr; % crate the sum and write on the following clock cycle 11 of 30

12 The IJVM MAL (p ) IJVM Microinstruction 1 (MIC-1) Architecture Language (1 of 4) main1 = + 1; ; goto (MBR) MBR holds opcode; get next byte; dispatch nop1 goto main1 Do nothing iadd1 MAR = SP = SP-1; rd Read in next-to-top word on stack iadd2 H = TOS H = top of stack iadd3 MDR = TOS = MDR + H; wr; goto main1 Add top two words; write to top of stack isub1 MAR = SP = SP-1; rd Read in next-to-top word on stack isub2 H = TOS H = top of stack isub3 MDR = TOS = MDR - H; wr; goto main1 Do subtraction; write to top of stack iand1 MAR = SP = SP-1; rd Read in next-to-top word on stack iand2 H = TOS H = top of stack iand3 MDR= TOS = MDR AND H; wr; goto main1 Do AND; write to new top of stack ior1 MAR = SP = SP-1; rd Read in next-to-top word on stack ior2 H = TOS H = top of stack ior3 MDR = TOS = MDR OR H; wr; Do OR; write to new top of stack goto main1 dup1 MAR = SP = SP + 1 Increment SP and copy to MAR dup2 MDR = TOS; wr; goto main1 Write new stack word pop1 MAR = SP = SP-1; rd Read in next-to-top word on stack pop2 Wait for new TOS to be read from memory pop3 TOS = MDR; goto main1 Copy new word to TOS swap1 MAR = SP-1; rd Set MAR to SP-1; read 2nd word from stack swap2 MAR = SP Set MAR to top word swap3 H = MDR; wr Save TOS in H; write 2nd word to top of stack swap4 MDR = TOS Copy old TOS to MDR swap5 MAR = SP-1; wr Set MAR to SP-1; write as 2nd word on stack swap6 TOS = H; goto main1 Update TOS 12 of 30

13 IJVM Microinstruction 1 (MIC-1) Architecture Language (2 of 4) bipush1 SP = MAR = SP + 1 MBR = the byte to push onto stack bipush2 = + 1; Increment, next opcode bipush3 MDR = TOS = MBR; wr; goto main1 Sign-extend constant and push on stack iload1 H = LV MBR contains index; copy LV to H iload2 MAR = MBRU + H; rd MAR = address of local variable to push iload3 MAR = SP = SP + 1 SP points to new top of stack; prepare write iload4 = + 1; ; wr Inc ; get next opcode; write top of stack iload5 TOS = MDR; goto main1 Update TOS istore1 H = LV MBR contains index; Copy LV to H istore2 MAR = MBRU + H MAR = address of local variable to store into istore3 MDR = TOS; wr Copy TOS to MDR; write word istore4 SP = MAR = SP-1; rd Read in next-to-top word on stack istore5 = + 1; Increment ; next opcode istore6 TOS = MDR; goto main1 Update TOS wide1 = + 1; ; Multiway branch with high bit set goto (MBR OR 0x100) wide_iload1 = + 1; MBR contains 1st index byte; 2nd wide_iload2 H = MBRU << 8 H = 1st index byte shifted left 8 bits wide_iload3 H = MBRU OR H H = 16-bit index of local variable wide_iload4 MAR = LV + H; rd; goto iload3 MAR = address of local variable to push wide_istore1 = + 1; MBR contains 1st index byte; 2nd wide_istore2 H = MBRU << 8 H = 1st index byte shifted left 8 bits wide_istore3 H = MBRU OR H H = 16-bit index of local variable wide_istore4 MAR = LV + H; goto istore3 MAR = address of local variable to store into ldc_w1 = + 1; MBR contains 1st index byte; 2nd ldc_w2 H = MBRU << 8 H = 1st index byte << 8 ldc_w3 H = MBRU OR H H = 16-bit index into constant pool ldc_w4 MAR = H + CPP; rd; goto iload3 MAR = address of constant in pool 13 of 30

14 IJVM Microinstruction 1 (MIC-1) Architecture Language (3 of 4) iinc1 H = LV MBR contains index; Copy LV to H iinc2 MAR = MBRU + H; rd Copy LV + index to MAR; Read variable iinc3 = + 1; Fetch constant iinc4 H = MDR Copy variable to H iinc5 = + 1; Fetch next opcode iinc6 MDR = MBR + H; wr; goto Put sum in MDR; update variable main1 goto1 O = - 1 Save address of opcode. goto2 = + 1; MBR = 1st byte of offset; 2nd byte goto3 H = MBR << 8 Shift and save signed first byte in H goto4 H = MBRU OR H H = 16-bit branch offset goto5 = O + H; Add offset to O goto6 goto main1 Wait for of next opcode iflt1 MAR = SP = SP - 1; rd Read in next-to-top word on stack iflt2 O = TOS Save TOS in O temporarily iflt3 TOS = MDR Put new top of stack in TOS iflt4 N = O; if (N) goto T; else goto Branch on N bit F ifeq1 MAR = SP = SP - 1; rd Read in next-to-top word of stack ifeq2 O = TOS Save TOS in O temporarily ifeq3 TOS = MDR Put new top of stack in TOS ifeq4 Z = O; if (Z) goto T; else goto Branch on Z bit F if_icmpeq1 MAR = SP = SP - 1; rd Read in next-to-top word of stack if_icmpeq2 MAR = SP = SP - 1 Set MAR to read in new top-ofstack if_icmpeq3 H = MDR; rd Copy second stack word to H if_icmpeq4 O = TOS Save TOS in O temporarily if_icmpeq5 TOS = MDR Put new top of stack in TOS if_icmpeq6 Z = O - H; if (Z) goto T; else goto F If top 2 words are equal, goto T, else goto F T O = - 1; goto goto2 Same as goto1; needed for target address F = + 1 Skip first offset byte F2 = + 1; now points to next opcode F3 goto main1 Wait for of opcode 14 of 30

15 IJVM Microinstruction 1 (MIC-1) Architecture Language (4 of 4) invokevirtual1 = + 1; MBR = index byte 1; inc., get 2nd byte invokevirtual2 H = MBRU << 8 Shift and save first byte in H invokevirtual3 H = MBRU OR H H = offset of method pointer from CPP invokevirtual4 MAR = CPP + H; rd Get pointer to method from CPP area invokevirtual5 O = + 1 Save Return in O temporarily invokevirtual6 = MDR; points to new method; get param count invokevirtual7 = + 1; Fetch 2nd byte of parameter count invokevirtual8 H = MBRU << 8 Shift and save first byte in H invokevirtual9 H = MBRU OR H H = number of parameters invokevirtual10 = + 1; Fetch first byte of # locals invokevirtual11 TOS = SP - H TOS = address of OBJREF - 1 invokevirtual12 TOS = MAR = TOS + 1 TOS = address of OBJREF (new LV) invokevirtual13 = + 1; Fetch second byte of # locals invokevirtual14 H = MBRU << 8 Shift and save first byte in H invokevirtual15 H = MBRU OR H H = # locals invokevirtual16 MDR = SP + H + 1; wr Overwrite OBJREF with link pointer invokevirtual17 MAR = SP = MDR; Set SP, MAR to location to hold old invokevirtual18 MDR = O; wr Save old above the local variables invokevirtual19 MAR = SP = SP + 1 SP points to location to hold old LV invokevirtual20 MDR = LV; wr Save old LV above saved invokevirtual21 = + 1; Fetch first opcode of new method. invokevirtual22 LV = TOS; goto main1 Set LV to point to LV Frame ireturn1 MAR = SP = LV; rd Reset SP, MAR to get link pointer ireturn2 Wait for read ireturn3 LV = MAR = MDR; rd Set LV to link ptr; get old ireturn4 MAR = LV + 1 Set MAR to read old LV ireturn5 = MDR; rd; Restore ; next opcode ireturn6 MAR = SP Set MAR to write TOS ireturn7 LV = MDR Restore LV ireturn8 MDR = TOS; wr; goto main1 Save return value on original top of stack 15 of 30

16 IJVM Classes of Instructions (Instruction Set Architecture) Hex Mnemonic Meaning Basic Stack Operations Data Movement Instructions 0x10 BIPUSH byte Push byte onto stack 0x13 LDC_W index Push constant from constant pool onto stack 0x15 ILOAD varnum Push local variable onto stack 0x36 ISTORE varnum Pop word from stack and store in local variable 0x57 POP Delete word on top of stack 0x59 DUP Copy top word on stack and push onto stack 0x5F SWAP Swap the two top words on the stack Operand Arithmetic ALU Instructions 0x60 IADD Pop two words from stack; push their sum 0x64 ISUB Pop two words from stack; push their difference 0x7E IAND Pop two words from stack; push Boolean AND 0x80 IOR Pop two words from stack; push Boolean OR 0x84 IINC varnum const Add a constant to a local variable Branching Flow Control Instructions 0x99 IFEQ offset Pop word from stack and branch if zero 0x9B IFLT offset Pop word from stack and branch if less than zero 0x9F IF_ICMPEQ offset Pop two words from stack; branch if equal 0xA7 GOTO offset Unconditional branch Misc. Other Instructions 0x00 NOP Do nothing 0xC4 WIDE Prefix instruction; next instruction has a 16-bit index Special Operations Subroutine/ISR Control Instructions 0xB6 INVOKEVIRTUAL disp Invoke a method 0xAC IRETURN Return from method with integer value The operands byte, const, and varnum are 1 byte. The operands disp, index, and offset are 2 bytes. 16 of 30

17 DUP (0x59h) Pop the top value from the stack, push it back on the stack and then push another copy. JAVA: MAL: DUP main1 and dup1(0x59h) to dup2 Label Operations Comments main1 = + 1; ; goto (MBR) MBR holds opcode; get next byte; dispatch dup1 MAR = SP = SP + 1 Increment SP and copy to MAR dup2 MDR = TOS; wr; goto main1 Write new stack word Similar instructions: BIPUSH (0x10h) Push the supplied byte onto the stack. JAVA: BIPUSH byte MAL: main1 and bipush1(0x010) to bipush3 Label Operations Comments main1 = + 1; ; goto (MBR) MBR holds opcode; get next byte; dispatch bipush1 SP = MAR = SP + 1 MBR = the byte to push onto stack bipush2 = + 1; Increment, next opcode bipush3 Similar instructions: MDR = TOS = MBR; wr; goto main1 Sign-extend constant and push on stack 17 of 30

18 Executing the JAVA DUP Instruction in Mic-1 Cycle M main1 dup1 dup2 main1 INST = +1; ; goto (MBR) MAR = SP = SP + 1 MDR = TOS; wr; goto main1 = +1; ; goto (MBR) Next M gt (dup1) dup2 main1 gt (MBR) +1 MBR dup1 INST MAR rd/wr SP+1 wr MDR TOS SP SP SP+1 LV CPP TOS (@SP) H 18 of 30 Notes and figures are based on or taken from materials in the course textbook: A.S. Tanenbaum, Structured

19 Executing the JAVA BIPUSH Instruction in Mic-1 Cycle M main1 bipush1 bipush2 bipush3 main1 INST = +1; ; goto (MBR) SP = MAR = SP + 1 = + 1; MDR = TOS = MBR; wr; goto main1 = +1; ; goto (MBR) Next M gt (bipush1) bipush2 bipush3 main1 gt (MBR) MBR bipush1 BYTE INST MAR rd/wr SP+1 wr MDR BYTE SP SP SP+-1 LV CPP TOS (@SP) BYTE H 19 of 30 Notes and figures are based on or taken from materials in the course textbook: A.S. Tanenbaum, Structured

20 After further analysis: the MBR must operate as both gated latch and a clock flip-flop The gated latch is required by the Micro Program Counter. The M address must be used two clock cycles after the next instruction is requested using Main1. The MBR and MBRU data must be available on the B-bus for proper delay propagation and computation aligned to clock edges with 2 cycle delay after. Therefore, the MBR must be two separate fates, a gated D-latch for M and a clocked D flip=flop for the B-Bus!!! (1) CPU CLK I address bus +1 Fetch# Instruction Data Bus Next Inst or byte Fetch Latency MBR Latched by M Main1" MBR Clocked MAIN1: = + 1; ; goto (MBR) % MBR holds opcode; get next byte; dispatch 20 of 30

21 ILOAD (0x15h) Pushing a variable from the Local Variable Memory Space unto the stack JAVA: ILOAD varnum MAL: main1 and iload1(0x015) to iload5 Label Operations Comments main1 = + 1; ; goto (MBR) MBR holds opcode; get next byte; dispatch iload1 H = LV MBR contains index; copy LV to H iload2 MAR = MBRU + H; rd MAR = address of local variable to push iload3 MAR = SP = SP + 1 SP points to new top of stack; prepare write iload4 = + 1; ; wr Inc ; get next opcode; write top of stack iload5 TOS = MDR; goto main1 Update TOS Similar instructions: ISTORE 21 of 30

22 Executing the JAVA ILOAD Instruction in Mic-1 Cycle M main1 iload1 iload2 iload3 iload4 iload5 main1 INST = +1; ; goto (MBR) H= LV MAR= MBRU + H; rd MAR= SP = SP+1 = +1; ; wr TOS= MDR; goto main1 = +1; ; goto (MBR) Next M gt (iload1) iload2 iload3 iload4 iload5 main1 gt (MBR) MBR iload1 VARNM INST MAR rd/wr LV+VARNM rd SP+1 wr MDR PARAM SP SP SP+1 LV CPP TOS (@SP) PARAM H LV 22 of 30 Notes and figures are based on or taken from materials in the course textbook: A.S. Tanenbaum, Structured

23 WIDE ILOAD (0xC4 0x15) Pushing a variable from the Local Variable Memory Space unto the stack JAVA: WIDE ILOAD varnum1 varnum2 MAL: main1 and wide_iload1(0x115) to wide_iload4 and iload3 to iload5 Label Operations Comments main1 = + 1; ; goto (MBR) MBR holds opcode; get next byte; dispatch wide1 = + 1; ; goto (MBR OR 0x100) Multiway branch with high bit set wide_iload1 = + 1; MBR contains 1st index byte; 2nd wide_iload2 H = MBRU << 8 H = 1st index byte shifted left 8 bits wide_iload3 H = MBRU OR H wide_iload4 MAR = LV + H; rd; goto iload3 H = 16-bit index of local variable MAR = address of local variable to push iload3 MAR = SP = SP + 1 SP points to new top of stack; prepare write iload4 = + 1; ; wr Inc ; get next opcode; write top of stack iload5 TOS = MDR; goto main1 Update TOS Similar instructions: WIDE ISTORE, WIDE LDC_W index1 index2 23 of 30

24 Executing the JAVA WIDE ILOAD Instruction in Mic-1 Cycle M main1 wide1 wide_iload1 wide_iload2 wide_iload3 wide_iload4 iload3 INST Next M = +1; ; goto (MBR) gt (wide1) = + 1; ; goto (MBR OR 0x100) (0x00 OR JAMC) +1 = + 1; H = MBRU << 8 H = MBRU OR H MAR = LV + H; rd; goto iload3 MAR= SP = SP+1 wide_iload2 wide_iload3 wide_iload4 iload3 iload MBR wide1 iload1 VAR1 VAR2 MAR rd/wr MDR SP SP LV CPP TOS (@SP) H VAR1<< 8 VAR1<< 8 OR VAR2 LV+H rd 24 of 30 Notes and figures are based on or taken from materials in the course textbook: A.S. Tanenbaum, Structured

25 IINC (0x84) Increment (add a 2 s comp constant to) a local variable JAVA: IINC varnum1 constant MAL: main1 and iinc1(0x084) to iinc6 Label Operations Comments main1 = + 1; ; goto (MBR) MBR holds opcode; get next byte; dispatch iinc1 H = LV MBR contains index; Copy LV to H iinc2 MAR = MBRU + H; rd Copy LV + index to MAR; Read variable iinc3 = + 1; Fetch constant iinc4 H = MDR Copy variable to H iinc5 = + 1; Fetch next opcode iinc6 MDR = MBR + H; wr; goto main1 Put sum in MDR; update variable GOTO (0xA7) Unconditional branch operation JAVA: GOTO offset MAL: main1 and goto1(0x0a7) to goto6 Label Operations Comments main1 = + 1; ; goto (MBR) MBR holds opcode; get next byte; dispatch goto1 O = - 1 Save address of opcode. goto2 = + 1; MBR = 1st byte of offset; 2nd byte goto3 H = MBR << 8 Shift and save signed first byte in H goto4 H = MBRU OR H H = 16-bit branch offset goto5 = O + H; Add offset to O goto6 goto main1 Wait for of next opcode 25 of 30

26 IFLT (0x9B) Conditional branch operation based on TOS value JAVA: IFLT offset MAL: main1 and iflt1(0x09b) to iflt4 then T or F Label Operations Comments main1 = + 1; ; goto (MBR) MBR holds opcode; get next byte; dispatch iflt1 MAR = SP = SP - 1; rd Read in next-to-top word on stack iflt2 O = TOS Save TOS in O temporarily iflt3 TOS = MDR Put new top of stack in TOS iflt4 N = O; if (N) goto T; else goto F Branch on N bit F = + 1 Skip first offset byte F2 = + 1; now points to next opcode F3 goto main1 Wait for of opcode T O = - 1; ; goto goto2 Same as goto1; needed for target address goto2 = + 1; MBR = 1st byte of offset; 2nd byte goto3 H = MBR << 8 Shift and save signed first byte in H goto4 H = MBRU OR H H = 16-bit branch offset goto5 = O + H; Add offset to O goto6 goto main1 Wait for of next opcode 26 of 30

27 Executing the JAVA IFLT(False) Instruction in Mic-1 Cycle M main1 iflt1 iflt2 iflt3 iflt4 F F2 F3 main1 INST Next M = +1; ; goto (MBR) MAR = SP = SP - 1; rd O = TOS TOS = MDR N = O; if (N) goto T; else goto F = + 1 = + 1; goto main1 = +1; ; goto (MBR) gt (iflt1) iflt2 iflt3 iflt4 F F2 F3 main1 gt (MBR) +1 MBR wide1 Offset_B1 INST MAR rd/wr SPI-1 rd MDR (@SP-1) SP SP SP-1 LV CPP TOS (@SP) (@SP-1) O TOS H of 30 Notes and figures are based on or taken from materials in the course textbook: A.S. Tanenbaum, Structured

28 Executing the JAVA IFLT(True) Instruction in Mic-1 Cycle etc M main1 iflt1 iflt2 iflt3 iflt4 T goto2 goto3 etc INST = +1; ; goto (MBR) MAR = SP = SP - 1; rd O = TOS TOS = MDR N = O; if (N) goto T; else goto F O = - 1; goto goto2 = + 1; H = MBR << 8 Next M gt (iflt1) iflt2 iflt3 iflt4 F goto2 goto3 goto4 etc MBR wide1 Off_B1 Off_B1 INST MAR rd/wr SPI-1 rd MDR (@SP-1) SP SP SP-1 LV CPP TOS (@SP) (@SP-1) O TOS -1 H Off_B1<<8 28 of 30 Notes and figures are based on or taken from materials in the course textbook: A.S. Tanenbaum, Structured

29 Define your own instruction (0x??) Description of instruction JAVA: MAL: main1 and Label Operations Comments main1 = + 1; ; goto (MBR) MBR holds opcode; get next byte; dispatch 29 of 30

30 Define your own instruction sequence page for practice. Executing the JAVA Instructions in Mic-1 Cycle M main1 INST = +1; ; goto (MBR) Next M gt (MBR) +1 MBR uinst Next Inst MAR rd/wr MDR SP LV CPP TOS H 30 of 30 Notes and figures are based on or taken from materials in the course textbook: A.S. Tanenbaum, Structured

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

Chapter 7D The Java Virtual Machine

Chapter 7D The Java Virtual Machine This sub chapter discusses another architecture, that of the JVM (Java Virtual Machine). In general, a VM (Virtual Machine) is a hypothetical machine (implemented in either hardware or software) that directly

More information

1 The Java Virtual Machine

1 The Java Virtual Machine 1 The Java Virtual Machine About the Spec Format This document describes the Java virtual machine and the instruction set. In this introduction, each component of the machine is briefly described. This

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

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

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

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

(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

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

language 1 (source) compiler language 2 (target) Figure 1: Compiling a program

language 1 (source) compiler language 2 (target) Figure 1: Compiling a program CS 2112 Lecture 27 Interpreters, compilers, and the Java Virtual Machine 1 May 2012 Lecturer: Andrew Myers 1 Interpreters vs. compilers There are two strategies for obtaining runnable code from a program

More information

Interpreters and virtual machines. Interpreters. Interpreters. Why interpreters? Tree-based interpreters. Text-based interpreters

Interpreters and virtual machines. Interpreters. Interpreters. Why interpreters? Tree-based interpreters. Text-based interpreters Interpreters and virtual machines Michel Schinz 2007 03 23 Interpreters Interpreters Why interpreters? An interpreter is a program that executes another program, represented as some kind of data-structure.

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

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

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

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

picojava TM : A Hardware Implementation of the Java Virtual Machine

picojava TM : A Hardware Implementation of the Java Virtual Machine picojava TM : A Hardware Implementation of the Java Virtual Machine Marc Tremblay and Michael O Connor Sun Microelectronics Slide 1 The Java picojava Synergy Java s origins lie in improving the consumer

More information

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 cwliu@twins.ee.nctu.edu. Computer Architecture Lecture 2: Instruction Set Principles (Appendix A) Chih Wei Liu 劉 志 尉 National Chiao Tung University cwliu@twins.ee.nctu.edu.tw Review Computers in mid 50 s Hardware was expensive

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

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

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

Introduction to Microcoded Implementation of a CPU Architecture

Introduction to Microcoded Implementation of a CPU Architecture Introduction to Microcoded Implementation of a CPU Architecture N.S. Matloff, revised by D. Franklin January 30, 1999, revised March 2004 1 Microcoding Throughout the years, Microcoding has changed dramatically.

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

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

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

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

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

TIMING DIAGRAM O 8085

TIMING DIAGRAM O 8085 5 TIMING DIAGRAM O 8085 5.1 INTRODUCTION Timing diagram is the display of initiation of read/write and transfer of data operations under the control of 3-status signals IO / M, S 1, and S 0. As the heartbeat

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

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

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

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

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

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

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

A3 Computer Architecture

A3 Computer Architecture A3 Computer Architecture Engineering Science 3rd year A3 Lectures Prof David Murray david.murray@eng.ox.ac.uk www.robots.ox.ac.uk/ dwm/courses/3co Michaelmas 2000 1 / 1 6. Stacks, Subroutines, and Memory

More information

University of Twente. A simulation of the Java Virtual Machine using graph grammars

University of Twente. A simulation of the Java Virtual Machine using graph grammars University of Twente Department of Computer Science A simulation of the Java Virtual Machine using graph grammars Master of Science thesis M. R. Arends, November 2003 A simulation of the Java Virtual Machine

More information

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

02 B The Java Virtual Machine

02 B The Java Virtual Machine 02 B The Java Virtual Machine CS1102S: Data Structures and Algorithms Martin Henz January 22, 2010 Generated on Friday 22 nd January, 2010, 09:46 CS1102S: Data Structures and Algorithms 02 B The Java Virtual

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

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

Java Programming. Binnur Kurt binnur.kurt@ieee.org. Istanbul Technical University Computer Engineering Department. Java Programming. Version 0.0.

Java Programming. Binnur Kurt binnur.kurt@ieee.org. Istanbul Technical University Computer Engineering Department. Java Programming. Version 0.0. Java Programming Binnur Kurt binnur.kurt@ieee.org Istanbul Technical University Computer Engineering Department Java Programming 1 Version 0.0.4 About the Lecturer BSc İTÜ, Computer Engineering Department,

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

Chapter 5, The Instruction Set Architecture Level

Chapter 5, The Instruction Set Architecture Level Chapter 5, The Instruction Set Architecture Level 5.1 Overview Of The ISA Level 5.2 Data Types 5.3 Instruction Formats 5.4 Addressing 5.5 Instruction Types 5.6 Flow Of Control 5.7 A Detailed Example: The

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

Habanero Extreme Scale Software Research Project

Habanero Extreme Scale Software Research Project Habanero Extreme Scale Software Research Project Comp215: Java Method Dispatch Zoran Budimlić (Rice University) Always remember that you are absolutely unique. Just like everyone else. - Margaret Mead

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

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

Central Processing Unit Simulation Version v2.5 (July 2005) Charles André University Nice-Sophia Antipolis

Central Processing Unit Simulation Version v2.5 (July 2005) Charles André University Nice-Sophia Antipolis Central Processing Unit Simulation Version v2.5 (July 2005) Charles André University Nice-Sophia Antipolis 1 1 Table of Contents 1 Table of Contents... 3 2 Overview... 5 3 Installation... 7 4 The CPU

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

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

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

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 (p2argade@cs.ucsd.edu) Office Hour: Tue./Thu. 9:30-10:30

More information

Instruction Set Architecture. Datapath & Control. Instruction. LC-3 Overview: Memory and Registers. CIT 595 Spring 2010

Instruction Set Architecture. Datapath & Control. Instruction. LC-3 Overview: Memory and Registers. CIT 595 Spring 2010 Instruction Set Architecture Micro-architecture Datapath & Control CIT 595 Spring 2010 ISA =Programmer-visible components & operations Memory organization Address space -- how may locations can be addressed?

More information

The Java Virtual Machine (JVM) Pat Morin COMP 3002

The Java Virtual Machine (JVM) Pat Morin COMP 3002 The Java Virtual Machine (JVM) Pat Morin COMP 3002 Outline Topic 1 Topic 2 Subtopic 2.1 Subtopic 2.2 Topic 3 2 What is the JVM? The JVM is a specification of a computing machine Instruction set Primitive

More information

Introduction. Application Security. Reasons For Reverse Engineering. This lecture. Java Byte Code

Introduction. Application Security. Reasons For Reverse Engineering. This lecture. Java Byte Code Introduction Application Security Tom Chothia Computer Security, Lecture 16 Compiled code is really just data which can be edit and inspected. By examining low level code protections can be removed and

More information

Stack machines The MIPS assembly language A simple source language Stack-machine implementation of the simple language Readings: 9.1-9.

Stack machines The MIPS assembly language A simple source language Stack-machine implementation of the simple language Readings: 9.1-9. Code Generation I Stack machines The MIPS assembly language A simple source language Stack-machine implementation of the simple language Readings: 9.1-9.7 Stack Machines A simple evaluation model No variables

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

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

The Java Virtual Machine and Mobile Devices. John Buford, Ph.D. buford@alum.mit.edu Oct 2003 Presented to Gordon College CS 311

The Java Virtual Machine and Mobile Devices. John Buford, Ph.D. buford@alum.mit.edu Oct 2003 Presented to Gordon College CS 311 The Java Virtual Machine and Mobile Devices John Buford, Ph.D. buford@alum.mit.edu Oct 2003 Presented to Gordon College CS 311 Objectives Review virtual machine concept Introduce stack machine architecture

More information

CSC 8505 Handout : JVM & Jasmin

CSC 8505 Handout : JVM & Jasmin CSC 8505 Handout : JVM & Jasmin Note: This handout provides you with the basic information about JVM. Although we tried to be accurate about the description, there may be errors. Feel free to check your

More information

An Overview of Stack Architecture and the PSC 1000 Microprocessor

An Overview of Stack Architecture and the PSC 1000 Microprocessor An Overview of Stack Architecture and the PSC 1000 Microprocessor Introduction A stack is an important data handling structure used in computing. Specifically, a stack is a dynamic set of elements in which

More information

Section 29. Instruction Set

Section 29. Instruction Set M Section 29. Instruction Set HIGHLIGHTS This section of the manual contains the following major topics: 29. Introduction...29-2 29.2 Instruction Formats...29-4 29.3 Special Function Registers as Source/Destination...29-6

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

CS412/CS413. Introduction to Compilers Tim Teitelbaum. Lecture 20: Stack Frames 7 March 08

CS412/CS413. Introduction to Compilers Tim Teitelbaum. Lecture 20: Stack Frames 7 March 08 CS412/CS413 Introduction to Compilers Tim Teitelbaum Lecture 20: Stack Frames 7 March 08 CS 412/413 Spring 2008 Introduction to Compilers 1 Where We Are Source code if (b == 0) a = b; Low-level IR code

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

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

A Microprogramming Animation

A Microprogramming Animation A Microprogramming Animation Steven Robbins and Kay A. Robbins!"## Division of Computer Science The University of Texas at San Antonio San Antonio, TX 78249 Submitted: December 23, 1994 Last Revision:

More information

Keil C51 Cross Compiler

Keil C51 Cross Compiler Keil C51 Cross Compiler ANSI C Compiler Generates fast compact code for the 8051 and it s derivatives Advantages of C over Assembler Do not need to know the microcontroller instruction set Register allocation

More information

Stack Allocation. Run-Time Data Structures. Static Structures

Stack Allocation. Run-Time Data Structures. Static Structures Run-Time Data Structures Stack Allocation Static Structures For static structures, a fixed address is used throughout execution. This is the oldest and simplest memory organization. In current compilers,

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

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

ADVANCED PROCESSOR ARCHITECTURES AND MEMORY ORGANISATION Lesson-12: ARM

ADVANCED PROCESSOR ARCHITECTURES AND MEMORY ORGANISATION Lesson-12: ARM ADVANCED PROCESSOR ARCHITECTURES AND MEMORY ORGANISATION Lesson-12: ARM 1 The ARM architecture processors popular in Mobile phone systems 2 ARM Features ARM has 32-bit architecture but supports 16 bit

More information

Building a computer. Electronic Numerical Integrator and Computer (ENIAC)

Building a computer. Electronic Numerical Integrator and Computer (ENIAC) Building a computer Electronic Numerical Integrator and Computer (ENIAC) CSCI 255: Introduc/on to Embedded Systems Keith Vertanen Copyright 2011 Layers of abstrac

More information

COMPUTER ORGANIZATION AND ARCHITECTURE. Slides Courtesy of Carl Hamacher, Computer Organization, Fifth edition,mcgrawhill

COMPUTER ORGANIZATION AND ARCHITECTURE. Slides Courtesy of Carl Hamacher, Computer Organization, Fifth edition,mcgrawhill COMPUTER ORGANIZATION AND ARCHITECTURE Slides Courtesy of Carl Hamacher, Computer Organization, Fifth edition,mcgrawhill COMPUTER ORGANISATION AND ARCHITECTURE The components from which computers are built,

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

Preface. Any questions from last time? A bit more motivation, information about me. A bit more about this class. Later: Will review 1st 22 slides

Preface. Any questions from last time? A bit more motivation, information about me. A bit more about this class. Later: Will review 1st 22 slides Preface Any questions from last time? Will review 1st 22 slides A bit more motivation, information about me Research ND A bit more about this class Microsoft Later: HW 1 Review session MD McNally about

More information

Microprocessor and Microcontroller Architecture

Microprocessor and Microcontroller Architecture Microprocessor and Microcontroller Architecture 1 Von Neumann Architecture Stored-Program Digital Computer Digital computation in ALU Programmable via set of standard instructions input memory output Internal

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

- Applet java appaiono di frequente nelle pagine web - Come funziona l'interprete contenuto in ogni browser di un certo livello? - Per approfondire

- Applet java appaiono di frequente nelle pagine web - Come funziona l'interprete contenuto in ogni browser di un certo livello? - Per approfondire - Applet java appaiono di frequente nelle pagine web - Come funziona l'interprete contenuto in ogni browser di un certo livello? - Per approfondire il funzionamento della Java Virtual Machine (JVM): -

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

Inside the Java Virtual Machine

Inside the Java Virtual Machine CS1Bh Practical 2 Inside the Java Virtual Machine This is an individual practical exercise which requires you to submit some files electronically. A system which measures software similarity will be used

More information

Z80 Microprocessors Z80 CPU. User Manual UM008006-0714. Copyright 2014 Zilog, Inc. All rights reserved. www.zilog.com

Z80 Microprocessors Z80 CPU. User Manual UM008006-0714. Copyright 2014 Zilog, Inc. All rights reserved. www.zilog.com Z80 Microprocessors Z80 CPU UM008006-0714 Copyright 2014 Zilog, Inc. All rights reserved. www.zilog.com ii Warning: DO NOT USE THIS PRODUCT IN LIFE SUPPORT SYSTEMS. LIFE SUPPORT POLICY ZILOG S PRODUCTS

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

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

Compilers I - Chapter 4: Generating Better Code

Compilers I - Chapter 4: Generating Better Code Compilers I - Chapter 4: Generating Better Code Lecturers: Paul Kelly (phjk@doc.ic.ac.uk) Office: room 304, William Penney Building Naranker Dulay (nd@doc.ic.ac.uk) Materials: Office: room 562 Textbook

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

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

X86-64 Architecture Guide

X86-64 Architecture Guide X86-64 Architecture Guide For the code-generation project, we shall expose you to a simplified version of the x86-64 platform. Example Consider the following Decaf program: class Program { int foo(int

More information

Virtual Machine Showdown: Stack Versus Registers

Virtual Machine Showdown: Stack Versus Registers Virtual Machine Showdown: Stack Versus Registers Yunhe Shi, David Gregg, Andrew Beatty Department of Computer Science University of Dublin, Trinity College Dublin 2, Ireland {yshi, David.Gregg, Andrew.Beatty}@cs.tcd.ie

More information

Lecture 3 Addressing Modes, Instruction Samples, Machine Code, Instruction Execution Cycle

Lecture 3 Addressing Modes, Instruction Samples, Machine Code, Instruction Execution Cycle Lecture 3 Addressing Modes, Instruction Samples, Machine Code, Instruction Execution Cycle Contents 3.1. Register Transfer Notation... 2 3.2. HCS12 Addressing Modes... 2 1. Inherent Mode (INH)... 2 2.

More information

Lecture 7: Machine-Level Programming I: Basics Mohamed Zahran (aka Z) mzahran@cs.nyu.edu 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) mzahran@cs.nyu.edu http://www.mzahran.com Some slides adapted (and slightly modified)

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

AVR 32-bit Microcontroller. Java Technical Reference. 1. Introduction. 1.1 Intended audience. 1.2 The AVR32 Java Extension Module

AVR 32-bit Microcontroller. Java Technical Reference. 1. Introduction. 1.1 Intended audience. 1.2 The AVR32 Java Extension Module 1. Introduction 1.1 Intended audience This manual is intended for developers implementing Java virtual machines or Java debuggers using the AVR 32 Java Extension Module, or others needing information on

More information

Informatica e Sistemi in Tempo Reale

Informatica e Sistemi in Tempo Reale Informatica e Sistemi in Tempo Reale Introduction to C programming Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa October 25, 2010 G. Lipari (Scuola Superiore Sant Anna)

More information

2) Write in detail the issues in the design of code generator.

2) Write in detail the issues in the design of code generator. COMPUTER SCIENCE AND ENGINEERING VI SEM CSE Principles of Compiler Design Unit-IV Question and answers UNIT IV CODE GENERATION 9 Issues in the design of code generator The target machine Runtime Storage

More information

Lecture Outline. Stack machines The MIPS assembly language. Code Generation (I)

Lecture Outline. Stack machines The MIPS assembly language. Code Generation (I) Lecture Outline Code Generation (I) Stack machines The MIPS assembl language Adapted from Lectures b Profs. Ale Aiken and George Necula (UCB) A simple source language Stack- machine implementation of the

More information

Chapter 2 Basic Structure of Computers. Jin-Fu Li Department of Electrical Engineering National Central University Jungli, Taiwan

Chapter 2 Basic Structure of Computers. Jin-Fu Li Department of Electrical Engineering National Central University Jungli, Taiwan Chapter 2 Basic Structure of Computers Jin-Fu Li Department of Electrical Engineering National Central University Jungli, Taiwan Outline Functional Units Basic Operational Concepts Bus Structures Software

More information

CS:APP Chapter 4 Computer Architecture. Wrap-Up. William J. Taffe Plymouth State University. using the slides of

CS:APP Chapter 4 Computer Architecture. Wrap-Up. William J. Taffe Plymouth State University. using the slides of CS:APP Chapter 4 Computer Architecture Wrap-Up William J. Taffe Plymouth State University using the slides of Randal E. Bryant Carnegie Mellon University Overview Wrap-Up of PIPE Design Performance analysis

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

Levels of Programming Languages. Gerald Penn CSC 324

Levels of Programming Languages. Gerald Penn CSC 324 Levels of Programming Languages Gerald Penn CSC 324 Levels of Programming Language Microcode Machine code Assembly Language Low-level Programming Language High-level Programming Language Levels of Programming

More information