recitation_week_15 - Problem 2 The following is the state...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Problem 1 Read the MIPS code and answer the following questions. (a) What does function f1 do? Ans: Find the first i such that A[i]-B[i] < C[i] (b) What will f1 return in $v0? Ans. 3 .text .globl main main: la $a0, A la $a1, B la $a2, C li $a3, 10 jal f1 li $v0,10 #exit syscall f1: li $v0, -1 ble $a3, $0, L3 li $t7, 0 L1: lw $t0, 0($a0) lw $t1, 0($a1) lw $t2, 0($a2) sub $t0, $t0, $t1 blt $t0, $t2, L2 addi $a0, $a0, 4 addi $a1, $a1, 4 addi $a2, $a2, 4 addi $t7, $t7, 1 blt $t7, $a3, L1 j L3 L2: addi $v0,$t7,0 L3: jr $ra .data A: .word 10,21,45,8,100,15,29,12,3,19 B: .word 2,5,33,5,20,1,53,52,5,5 C: .word 6,8,5,4,5,22,53,12,33,89
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Problem 2 The following is the state diagram for a circuit that has two inputs, clk and X, and four states. Similar to the previous question, X may change every clock cycle, and the change happens at the falling edge of the clock. The circuit samples the input at every rising edge of the clock. If the input is 1, consider as read a 1, else read a 0. Assume that the circuit started in state S0. Please write in the figure to indicate the change of the state according to the input. S0 S1 S1 S2 S3 S2 S3 S1 S0 S1 S2 S3 X=1 X=0 X=1 X=0 X=1 X=0 X=1 X=0...
View Full Document

{[ snackBarMessage ]}

Page1 / 2

recitation_week_15 - Problem 2 The following is the state...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online