Assume a program requires the execution of 50×106 FP instructions, 110×106 INT instructions, 80×106 L/S instructions, and 16×106 branch instructions. The CPI for each type of instruction is 1, 1, 4, and 2, respectively. Assume that the processor has a 2 GHz clock rate.
Calculate the number of clock cycles and the time needed for executing the program.
Assume a program requires the execution of 50×106 FP instructions, 110×106 INT instructions, 80×106 L/S instructions, and 16×106 branch instructions. The CPI for each type of instruction is 1, 1, 4, and 2, respectively. Assume that the processor has a 2 GHz clock rate.
Copyright By PowCoder代写 加微信 powcoder
Calculate the number of clock cycles and the time needed for executing the program.
clock cycles = CPI fp × No. FP instr. + CPI int × No. INT instr. +
+CPI l/s × No.L/S instr. + CPI branch × No. branch instr.
time CPU = clock cycles/clock rate = clock cycles/2 × 109 clock cycles = (50+110+320+32=512) × 106 ; T CPU = 0.256 s
Consider a computer running a program that requires 230 s, with 70 s spent executing FP instructions, 90 s executed L/S instructions, and 40 s spent executing branch instructions.
By how much is the total time reduced if the time for FP operations is reduced by 20%? Show your calculations.
Consider a computer running a program that requires 230 s, with 70 s spent executing FP instructions, 90 s executed L/S instructions, and 40 s spent executing branch instructions.
By how much is the total time reduced if the time for FP operations is reduced by 20%? Show your calculations.
FP = 70 s L/S = 90 s BR = 40 s Other = 30 s
Tfp = 70 × 0.8 = 56 s.
Tnew = 56 + 90 + 40 + 30 = 216 s. Reduction: 14 s
What is the decimal value of the largest signed integer that can fit in 8 bits? Write the answer in decimal and show how you obtained it.
Binary: 0111 1111 (must be positive, so MSB=0 and all other bits are 1s)
What is the decimal value of the smallest signed integer that can fit in 8 bits? Write the answer in decimal and show how you obtained it.
Binary: 1000 0000 (must be negative, so MSB=1 and all other bits are 0s) (It is obtained by inverting the bits of the binary representation of 127)
Write the binary code for the instruction xor x1, x2, x3. 0000000 00011 00010 100 00001 0110011
F7 rs2 rs1 F3 rd OPCODE
Attention to:
•RISC-V Green Card: OPCODES IN NUMERICAL ORDER BY OPCODE
•Instruction format: R •OPCODE: 0110011 •FUNCT3: 100 •FUNCT7: 0000000 •rd: x1 00001
•rs1: x2 00010 •rs2: x3 00011
Not suitable for online tests so adjustments will be made.
For the binary instruction code
000000010100 00110 001 00101 0010011
write the corresponding assembly language instruction denoting the registers by x0,x1,…,x31 and specifying the immediate values in
slli x5, x6, 20
000000010100 00110 001 00101 0010011
F7 IMM rs1 F3 rd OPCODE
Attention to:
•RISC-V Green Card: OPCODES IN NUMERICAL ORDER BY OPCODE
•Instruction format: I •OPCODE: 0010011 •FUNCT3: 001 •FUNCT7: 0000000 •rd: x1 00101
•rs1: x2 00110
For the following questions, write the contents of the indicated registers (in the specified radix) after the fragment executes. For decimal radix, state the content as a signed integer. If an answer cannot be determined or the fragment has errors, write a brief explanation.
addi x1, x0, 25
addi x2, x1, -10
x1 (in hexadecimal) =
x2 (in hexadecimal) =
addi x1, x0, 25
addi x2, x1, -10
x1 (in hexadecimal) = 0x19 (25=16+9)
x2 (in hexadecimal) = 0xF (15=8+4+2+1)
Attention to:
•Simple arithmetic
•Decimal to hexadecimal conversion
Not suitable for online tests so adjustments will be made.
Write a minimal sequence of instructions that loads the value of 0x1234500000000 in the register x5.
lui x6, 0x12
addi x5, x6, 0x345
slli x5, x5, 32
Attention to:
•Solve with a minimal number of instructions
lui x6, 0x12345
slli x5, x6, 20
Not suitable for online tests so adjustments will be made.
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com