Docsity

Solution Comp Org and Design 4th Patterson, Notas de estudo de Informática

Pré-visualização parcial do texto

Baixe Solution Comp Org and Design 4th Patterson e outras Notas de estudo em PDF para Informática, somente na Docsity!

Solutions Solution 4.1 4.1.1 The values of the signals are as follows: | Fio [vota | at | ato | Do | reu | Bh | a 1 o O(Reg) o Add 1 (ALI) o b. 1 a 1 (mm) o Add 1 (Mem) o ALUMux is the control signal that controls the Mux at the ALU input, O (Reg) selects the output of the register file and 1 (Imm) selects the immediate from the instruction word as the second input to the ALU. RegMux is the control signal that controls the Mux at the Data input to the regis- ter file, O (ALU) selects the output of the ALU and 1 (Mem) selects the output of memory. Avalue of X is a “don't care” (does not matter if signal is O or 1) 4.1.2 Resources performing a useful function for this instruction are: a. | Allexoept Data Memory and branch Add unit be | Allexoept branch Add unit and second read port of the Fegisters. 413 mi] Outputs that are not used No outputs a | Brandhado Data Memory b. | Branch Ada, second read port of Registers None (all units produce outputs) 4,14 One long path for and instruction is to read the instruction, read the reg- isters, go through the ALUMux, perform the ALU operation, and go through the Musx that controls the write data for Registers (1-Mem, Regs, Mux, ALU, and Munx). The other long path is similar, but goes through Control while registers are read (I- Mem, Control, Mux, ALU, Mux). There are other paths but they are shorter, such as the PC increment path (only Add and then Mux), the path to prevent branching (I-Mem, Control, Mux uses Branch signal to select the PC + 4 input as the new value for PC), the path that prevents a memory write (only I-Mem and then Control, etc). a. | Control is faster than registers, so the critical path is Hvem, Res, Mu, ALU, Mun be | Control is faster than registers, so the critical path is Hm, Regs, Mux, ALU, Muk. 4.1.5 One long path is to read instruction, read registers, use the Mux to select the immediate as the second ALU input, use ALU (compute address), access D-Mem, and use the Mux to select that as register data input, so we have I-Mem, Regs, Mux, ALU, D-Mem, Mux, The other long path is similar, but goes through Control instead of Regs (to generate the control signal for the ALU MUX). Other paths are shorter, and are similar to shorter paths described for 4.1.4. a. | Control is faster than registers, so the critical path is vem, Regs, Mu, ALU, Diem, Mun. be | Control is faster than registers, so the critical path is Hvem, Regs, Mu, ALU, Mu 4.1.6 This instruction has two kinds of long paths, those that determine the branch condition and those that compute the new PC. To determine the branch condition, we read the instruction, read registers or use the Control unit, then use the ALU Muxand then the ALU to compare the two values, then use the Zero out- put of the ALU to control the Mux that selects the new PC. As in 4.1.4 and 4.1.5: a. | Te first path (through Regs) is longer. be | The first path (through Regs) is longer. To compute the PC, one path is to increment it by 4 (Add), add the ofiser (Add), and select that value as the new PC (Mux). The other path for computing the PC is to Read the instruction (to get the offset), use the branch Add unit and Mux. Both of the compute-PC paths are shorter than the critical path that determines the branch condition, because I-Mem is slower than the PC + 4 Add unit, and because ALU is slower than the branch Add, Solution 4,2 4.241. Existing blocks that can be used for this instruction are: a. | This instruction uses instruction memory both existing read ports of Registers, the ALU, and the write port of Registers. be | This instruction uses the instruction memany, one of the existing register read ports, the path that passed the immediate to the ALU, and the register write port. 4.2.2 New functional blocks needed for this instruction are: a. | Another read port in Registers (to read Rx) and either a second ALU (to add Rx to Rs + Rt) ora third input to the existing ALU. be | Vie need to extend the existing ALU to also do shifls (adds a SUL ALU operation). Solution 4,3 431 aa | Bon, is mostly iprcps, bt it has logo that controls viich lipiops get read ar written in canoae Bonn. 1 is mes Hipriops, but has log tar cornos wii pio get read cr wrien in eachode 432 A ao Da aus di This shows the lowermost bit of each word. This schematic is repeated 7 more times for the remaining seven bits, Note that there are no connec- tions for D and C flip-flop inputs because datapath figures do not specify how instruction memory is written. Chapter 4 Solutions FRegt d > Rego. WData O: 1 Pego is par cla Regwrite Cc RData? O Wrog —d RRog2 “This is the schematic for the lowermost bit, it needs to be repeated 7 more times for the remaining bits. RRegl is the Read Register 1 input, RReg2 is the Read Register 2 input, WReg is the Write Register input, WData is the Write Data input. RDatal and RData2 are Read Data 1 and Read Data 2 outputs. Data outputs and input have 0 to denote that this is onky bit O of the 8-bit signal. ap DO + tnsructono be | Nochange, there are no gates with more then 2 inputs in the schemati, 4.3.4 Thelatency of a path is the latency from an input (or a D-clement output) toan output (or Deelement input). The latency of the circuit is the latency of the path with the longest latency. Note that there are many correct ways to design the eae 432, and for each solution to 4.3.2 there is a different solution for this 4,35 The cos cf the implementation is simply the total cost of all its compo- nents. Note that there are many correct ways to design the circuit in 4.3.2, and for each solution to 4.3.2 there is a different solution for this problem. 43.6 & | Because multrinput AND arclOR gates hene tre same latonoy as Zinput ones, we can use manirput gates to recuo the number of gets on tne pat rem Inputs to outputs. The schematic shown for 4.3.2 tums aut to already be optima de | A trressnput or a fourinput gate nes a lower Istercy tran a cascade of two Zaput gates, Tris means that short overalIteroy is achieved by using 3- and 4irput entes rather then cascades of Zinput gates. hn cur scheme shown for 43.2, ve should reolsoe the ihree Zina AND gates use for Cod, Rest, and Weg sais vt two Singut AND gates that Sirectiy determine the value of the C input for each Delemem. Solution 4,4 444.1 We show the implementation and also determine the latency (in gates) needed for 4.4.2, oi ema au om 4 aq c > 4 44,2 Sec answer for 4.4.1 above. Cant Cycle timo Operation time a S0ps (OR, AND, D) 32 x 90ps = 2880p5. db. ATOpS (NOT, AND, D) 32x 170ps = 544095 454 Cycle timo a 12095 (OR, AND, AND, D) (S2x 90ps)/(16 x 12095)= 1.50 bd Ops (NOT, AND) (32x 17005)/6 x 9005) =3.78. ss Circuit 1 Circuit 2 a JA (LAND, 1 0R,1X0R, 10) 20(2 AND, 1. OR, 2X08, 1 D) de 29 (LNOL2AND,2D) 29 (1 NOT, 2 AND,2D) 456 Cost/Performance Cost/Performance for Circuit 1 for Circuit 2. a.| 14x32x90=40320 | 20x16x120=38400 | Cosypertommenoe or Circuit 2 is better by aba 4. 7% be | 29x32x170=157760 | 29x 16x90=41760 | Cosy performance of Circuit 2 is better by about 735% Solution 4.6 4.6.1 1-Mem takes longer than the Add unit, so the clock cycle timeiis equalto the latency of the I-Mem: a | 4005 de | 5005 4.6.2 The critical path for this instruction is through the instruction memory, Sign-extend and Shift-left-2 to get the offset, Add unit to compute the new PC, and Mux to select that value instead of PC + 4, Note that the path through the other Add unit is shorter, because the latency of T-Mem is longer that the latency of the Add unit. We have: & | 400p5.+ 20p5-+ 205 + 100ps + 30ps = 552p5 these latencies: be | 500ps+90ps + 20p5 +150ps + 100ps = 860ps| 4,6.3 Conditional branches have the same long-latency path that computes the branchaddressas unconditional branches do. Addlitionally they havea long-latency path that goes through Registers, Mux, and ALU to compute the PCSrc condition. The critical path is the longer of the two, and the path through PCSre is longer for & | 400ps+200pS + 30ps + 120ps + 30ps = 780p5 de | 500ps + 220p5 + 10005 + 180ps + 100ps = 1100p5 464 “a. | All instructions except jumps that are not POxelative (a, a.) da | Lois andstoxes 46.5 & | None. kem is skower, and all instructions (even NOP) need to read he instructicn. b. | Loxis andsires. 4,6.6 Of the two instruction (bne and add), bne has a longer critical path so it determines the clock cycle time, Note that every path for add is shorter or equal to than the corresponding path for bne,so changes in unit latency will not affect this. Asa result, we focus on how the units latency aftects the critical path of bne: a. | This unit is not on the critical pat, so Changes to ils latency do not affect tre clock oycte time untess the Estenoy of the unit becomes so large to create a new critical path trvovgl this unit, the branch ada, and the PC Mu. The latenoy of this path is 230ps and needs to be above 780ps, so the latenoyof the Add-4 unit needs to be more 650ps for it to be on the critical path. da | This unit is not used by BNE nor by ADO, so it cannot affect the critical path for either Solution 4.7 4,7.1 Thelongest-latency path for ALU operations is through I-Mem, Regs, Mux (to select ALU operand), ALU, and Mux (to select value for register write). Note that the only other path of interest is the PC-increment path through Add (PC + 4) and Mus, which is much shorter. So for the I-Mem, Regs, Mux, ALU, Mux path we have: au | 400pS+ 200ps + 30ps + 120p5 + 30ps = 780ps. be | 500p5-+ 220p5 + 100pS + 150p5 + 10095 = 110095 | 4,72 The longest-latency path for Iwis through I-Mem, Regs, Mux (to select ALU input), ALU, D-Dem, and Mux (to select what is written to register), The only other interesting paths are the PC-increment path (which is much shorter) and the path through Sign-extend unit in address computation instead of through Registers. However, Regs has a longer latency than Sign-extend, so for I-Mem, Regs, Mux, ALU, D-Mem, and Mux path we have: 400PS + 20098 + 30pS + 12075 + 35005 + 30p8 = 1130ps. b. | 500p5 + 220p5 + 100p5 + 180p5 + 100095 + 10095 = 2100ps | 4.7.3 The answer is the same as in 4.7.2 because the 1 w instruction has the longest critical path. The longest path for sw is shorter by one Mux latency (no write to register), and the longest path for add or bne is shorter by one D-Mem latency. 4,744 The data memory is usod by Ti and su instructions, so the answer is: a | 20% +10%= 30% b. | 35% +15%=50% 484 & | 1 Mempeadis stuck at O, data memary is reaa for exery instruction. However, for nondoaa instructions the value from memery is discarded by the Miux that selects the value to be writen to the Register uni. As a resul, we cannot design Inis kind of test for his fault because the processor stil operates correctly (althougn ineffcientiy). da | Totest forthis faut, we need an instruction viose opoode is zero and MemRead is 1. However, Vl dj um one resul, we cannot design his Kind of test for this fault, becaus the processor operates correctly. 485 & | If JumpiS Stckat-, every instructon unciates the PC as if itwere a jump insruction. 10 test for tis faut we Can execute an ADDI vi) a nonasro immeiate operan, fthe Jump Sigralis Stude. ad, the PC after the ADOI executes vil not be pointig to the instruction the folows the ADDI, ba | Totest for this faut, ve nesd an instructon whose opoode is zero and Jump is L. Honexes, the opoodo for the jump instruction is nono. As a resul, wo carot design this kind of test for tis fault, Desause the processor operates correctiy. 4.86 Each single-instruction test “covers” all faults that, if present, result in dif- ferent behavior for the test instruction. To test for as many of these faults as possi- ble in a single instruction, we need an instruction that sets as many of these signals to a value that would be changed by a fault. Some signals cannot be tested using this single-instruction method, because the fault on a signal could still result in completely correct execution of all instruction that trigger the fault. Solution 4.9 4.91 as | 100011 0011000001 0000000000104000 BOc10028 be. | Ouosos oo00a 0o01o ataisasiasarmaas A422F 492 Read registor1 | Actuallyreod? | Readregister2 | Actually rear? | | 6cono) ves. 100004) Yes (out not used) de) 10004 ves, 2400010) ves, Chapter 4 Sokitions 493 a 1(00004,) Yes bd. | Either 2 (000104) 0! 31 (111114) (dont inow No because RegDst is X) 494 4.9.5 We use BB1 through 126 to denote individual bits of Instruction[31:26], which is the input to the Control unit: a | Regost=NoT EI ta | Regitrte = (NOT 128 AND NOT 127) OR (131 AND NOT 129) 4,9,6 IF possible, we try to reuse some or all of the logic needed for one signal to help us compute the other signal at a lower cost: a | Regost=NoT E MemRead = [81 AND NOT 29 [81 AND NOT 2 PRM = (NOTIZS AND NOT 27) OR Mareag Solution 4.10 To solve problems in this exercise, it helps to first determine the latencies of dif- ferent paths inside the processor, Assuming zero latency for the Control unit, the critical path is the path to get the data for a load instruction, so we have I-Mem, Mus, Regs, Mux, ALU, D-Mem and Mux on this path. 4,10.1 The Control unit can ego generating MemWrite only after -Mem is read, It must finish generating this signal before the end of the clock cycle. Note that MemWrite is actually a write-enable signal for D-Mem flip-flops, and the actual write is triggered by the edge of the dock signal, so MemWrite need not Chapter 4 Solutions arrive before that time. So the Control unit must generate the Mem Write in one clock cycle, minus the -Mem access tim Critical path Maximum time to generate Momrito a] 400p5+30p5+ 20005 + 3005 + 1160p5— 40008 = 76005 120p5 + 350ps + 30ps = 1160ps. be | 500ps + 100ps + 220p5+ 10005 + 22005 - S00ps= 1700ps. 180ps + 1000ps + 100ps = 2200ps. 4.10.2 AI control signals start to be generated after 1-Mem read is complete. The most slack a signal can have is until the end of the cycle, and MemiWrite and Reg- Write are both needed only at the end of the cycle, so they have the most stack. The time to generate both signals without increasing the critical path is the one computed in 4.10.1. 4.10.3 MemWrite and RegWrite are only needed by the end of the cycle. RegDst, Jump, and MemtoReg are needed one Mu latency before the end of the cycle, so they are more critical than Mem Write and RegWrite. Branch is needed two Mux latencies before the end of the cycle, so it is more critical than these. MemRead is needed one D-Mem plus one Mux latency before the end of the cycle, and D-Mem has more latency than a Mux, so MemRead is more critical than Branch. ALUOp must get to ALU control in time to allow one ALU Ctrl, one ALU, one D-Mem, and one Mux latency before the end of the cycle, This is clearly more critical than MemRead. Finally ALUSrc must get to the pre-ALU Mux in time, one Mux, one ALU, one D-Mem, and one Mux latency before the endof the cycle. Again, this is more critical than MemRead. Between ALUOp and ALUSre, ALUOp is more critical than ALUSrc if ALU control has more latency than a Mux. If ALUOP is the most critical, it must be generated one ALU Curl latency before the critical-path signals can go through Mux, Regs, and Mu, If the ALUSrc signal is the most critical, it must be generated while the critical path g06s through Murx and Regs. We have The most critical control Time to generate it without. signal Is affecting the clock cycle time a ALUOp (50ps > 30p5) 30ps + 200p8 + 3095 — 50pS = 210p. de ALUSIO (100p5 > 55p5) 100ps + 220ps = 320ps. For the next three problems, it helps to compute for cach signal how much time we have to generate it before it starts affecting the critical path. We already did this for RegDstand RegWrite in 4.10.1, and in 4,10.3 we described how to do it forthe remaining control signals, We have: [eo E SE EE E d | FStam SIaenotequa, PC+4 PO to Ada (PC + 4) to branch Mu, or PC to E Si and $3 are equal, PC +4+4x 12 AMO (PC + 4) to Add (adás ofíset) to branch PE e Edno ai 4114 [tests | atuo | Mon Aa | Semci | depta | a 3 16 o PC+4 PC+4 db |3orO(RegDstisX) q x PC+4 FC+4 Chapter 4 Sokitions 411.5 [tu nasge+a = = = be -i6and-3 PCand4 PC+4andiZx4 411.6 2 3 3 o X 4 8 XxGero) x o HESI = E Solution 4.12 4121 EEE Singe-cyeto a 500ps 1650ps be 200ps 8B00ps 412.2 E a 2500ps 1650ps b 1000ps 800ps 412,3 Dema | memcodoretm | a MEM 400ps b IF 190ps 4124 a | 25% b | 45% a » HE 4,126 We already computed dock cycle times for pipelined and single cycle organizations in 4.12.1, and the multi-cycde organization has the same clock cycle time as the pipelined organization. We will compute execution times relative to the pipelined organization. In single-cyde, every instruction takes one (long) clock cycle. In pipelined, a long-running program with no pipeline stalls completes one instruction in every cycle. Finally, a multi-cycle organization completes a lw in Soycles, a swin 4 cyees (no WB), an ALU instruction in 4 cycles (no MEM), and a beq in 4 cyces (no WB). So we have the speed-up of pipeline Multicycie execution time is X times | Singiocyci execution time Is X times pipolined execution time, where X is | pipelinod execution time, whero X is a 045x5 +0.85x; 1650p5/500p = 330 » 050x5 +0.70x: 8095/2008 =4,00 Solution 4.13 4131 testruction sequenco Dependences a. | Il: Tw 51,40C56) RaWon SL rom LtoI3 add $6,82,82 RaWon S6 from to 13 2 sw 56,50(81) WAR on $6 from to Zand 3. de | Il: Iw 55,-16(55) RAWOn $5 from EL to 12 andiã 2 sw $5.-16(35) WAR cn $5 from EL and 2 o 13 + add 85,85,85 WAW on $5 from EL to 3 4.13:2 In the basic five-stage pipeline WAR and WAW dependences do not cause any hazards, Without forwarding, any RAW dependence between an instruction and the next two instructions (if register read happens in the second half of the clock cycle and the register write happens in the first half). The code that eliminates these hazards by inserting nop instructions is: Dekey 3 to avoid RAN hazard on S1 from IL a | lu $1,40(56) add $6,82,82 nop sw $6,50C$1) be | lu $5,-16(85) nop Delay 2 to avoid RAW hazard cn $5 from 11 nop, su $5,-16C85) add $5,85,85] Note: no RAW hezard from on 55 from 14. now 4,13.3 With full forwarding, an ALU instruction can forward a value to EX stage of the next instruction without a hazard. However, a load cannot forward to the EX stage of the next instruction (by can to the instruction after that). The code that climinates these hazards by inserting nop instructions is: | Instruction | soquenco a | Iw $1,40C36) ada $6,82,82 sw $6,50(81) No RAW hazardon $1 from 1 (forwarde) de | Tu 85,-16€55) nop Delay to axoid RAW hazard on $5 from 11 su 55,-16(55) Velue for $5 is forverded frem I2now ada $5,85,55 Note: no RAW heard from on 55 from 14 now 4.14.2 This change only saves one cycle in an entire execution without data bazares (such as the one given). This oycle is saved because the last instruction fin- ishes onecyele carlier (one lessstage to go through). IF there were data hazards from loadsto other instruction, the change would help eliminate some stall cycles. Instructions ser Executod a 4 a+4=8 3+4=7 de 5 4+5=9 3+5-8 98-113 4.14,3 Stallon-branch delays the fetch of the next instruction until the branch is executed. When branches execute in the EXE stage, each branch causes two stall cycles. When branches execute in the ID stage, each branch only causes one stall cycle Without branch stalls (e.g, with perfect branch prediction) there are nostals, and the execution time is 4 plus the number of executed instructions. We have: | Imsructions | Branchos | Cyloswith | Crolos with Es 4+4+1X2=10] 4+4+1x1=9 | 1/9=111 s 5 1 4+5+1X2=11[4+5+1x1=10| 11/10=110 4,144 The number of cycles for the (normal) 5-stage and the (combined EX/ MEM) 4-stage pipeline is already computed in 4.14.2. The lock cycle time is equal to the latency of the longest-atency stage. Combining EX and MEM stages affects clock time only if the combined EX/MEM stage becomes the longest-latency stage: Cycle time Cyde time with 5 stages with 4 stages Speedup a 130p5 (MEM) 150ps (MEM + 20p5) (8x130/(7x 150)=099 b 22068 (MEM) 240p3 (MEM + 2095) (9x220/(8x 240)=1.08 4145 NowEX | Newcycke | Okicyclo Intency time time a| 1805 ES 180PS (ID) | 130p5 (MEM) | (10x 13009 x: 0.80 bd] 15005 160ps | 22005 (MEM) | 220p5 (MEM | (11 x 220)/(40x 220) = 1.10 4.14.6 The cycle time remains unchanged: a 20ps pedeson a EXteney seno effect on clock cycle time because EX is not the longest-latency stage. The Chapter 4 Solutions does affect execution time because it adds one additional stall cycle to each branch. Because the clock cycle time does not improve but the number of cycles increases, the spoed-up from this change will be below 1 (a slowdown). In 4.143 we already computed the number of cycdes when branch is in EX stage. We have: Cycles withbranch | Executiontimo | Cycles withbranch | Executiontimo mEX branch in EX) in MEM Granel in MEM) E a 4+4+1x2=10 10x 130ps = 1300ps 4+4+1x3=11 11X 130p5= 1430p5 [cs &| 4s5+1x2=11 | 11x2005=2400s | 4+5+1x3=12 | 12x220p5=264p5 sz Solution 4,15 4151 a. | This instruction benaves lie a load valha zero offset until feiches the value from memory THE PRGALU Mu MUS NENE aNOther Input OM (280) O allow his. After the values rega from. memory in the MEM Stage, It MUS be Compare against zero. Mis must either be done quicidy in'the WE stage, or we must ad another siage betueen MEM and WB, Te resul o this zero- must then be used to control the branch Mu, delaying the selection signal for the branch Mux until the WB stage. | We ne to come pe memo aúídess Leg o regis ias, o ve adgess Data MemonyS writ cata input betueen tis value an the value for the normal SW instruction. 415.2 a | We need to add one more Dito tre conto sérel tor the preaLL] Mc We aiso reed a conto! skrl miar to he estng “Bane” siga to control whether ar not the now aero compare resul is alone to change tre PC. da | We need a control siga to control the new Min the EX stage. path (rom the mew stage to EX) or (here is no forwarding) makes a stal due toa data hazard one Sete longe. Do. | This Instrucon does not affect hazards, R maes no register, so causes no data hazards, is nota branch nstruction, so produoes no control hazards. With the added ni register read port arates no new resource azar, either. beg $2,80,Loop IF 4.16.5 In a particular clock cycle, a pipeline stage is not doing useful work ifit is stalled or if the instruction going through that stage is not doing any useful work there, In the pipeline execution diagram from 4.16.4, a stage is stalled ifits name is not shown for a particular cycles, and stages in which the particular instruction is not doing useful work are marked in red. Note that a BEQ instruction is doing use- ful work in the MEM stage, because it is determining the correct value of the next instructionts PC in that stage. We have: Cycles in winich al stages | *% OF cycles in wivich all “do useful work stages do useful work a 5 1 20% » 5 a 40% 4,16.6 Theaddress of that first instruction of the third iteration (PC + 4 for the beg from the previous iteration) and the instruction word of the beq from the previous iteration. Solution 4.17 4.174 Of all these instructions, the value produced by this adder is actually used only bya beg instruction when the branch is taken. We have: 15% (60% of 25%) 9% (60% of 1556) Ê [rl» 7.2. Of these instructions, only add needs all three register ports (reads two isters and write one). beq and st does not write any register, and 1w only uses register value. We have: 50% 30% 7.3 Of these instructions, only 1 and sw use the data memory: We have: 256 (15% + 1099) SE (35% + 2099) E el») R[r]»] é 417.4 The clock cyde time of a single-cyde is the sum of all latencies for the logicofall five stages. The clock cycle time of a pipelined datapath is the maximum Jatency o the fe sage log ltencõs, plus the atency of a pipeline register tt keeps the results of cach stage for the next stage. We have: [TO snócerdo E Spesdup a S00ps 140ps 357 » 730ps 2%ps 317 4,17.5 The latency of the pipelined datapath is unchanged (the maximum stage latency does not change). The clock cycle time of the single-cycle datapath is the sum of logic latencies for the four stages (IE, ID, WB, and the combined EX + MEM stage). We have: Ooo OT E Es ES be Se0ps 2305 417.6 Theclockoyce timeof the two pipelines (5-stage and 4-stage) asexplained for 4.17,5. The number of instructions increases for the 4-stage pipeline, so the spoedeup is below 1 (there isa slowdown): [ET a 100x1 100x1+05x(045+0:10)x1=1425x1 | 089 » 100x1 100X1+05x(035+0.30)xI=1275x1 | 078 Solution 4.18 4.181. No sigrals are asserted in IF and ID stages. For the remaining three stages wehave: a [AUSC=0,N10=10, Pegst=1 da [ALISC=0,AUOp=10, Regpst=1 4.182 One codeoyde. 4,18.3 The PCSrc signal is O for this instruction. The reason against generating the PCSrc signal in the EX stage is that the and must be done after the ALU com- putes its Zero output. If the EX stage is the longest-latency stage and the ALU out- put ison its critical path, the additional latency of an AND gate would increase the clock cycle time of the processor, The reason in favor of generating this signal inthe EX stage is that the correct next-PC fora conditional branch can be computed one cyele arlier, so we can avoid one stall cycle when wwe have a control hazard. Control signal 2 a Generated in, used in EX Generated in, used in wi » “eneatedin ID, used in MEM “Generated in, used in WB, Raype instucions.