On Tue, 2002-09-17 at 11:19, Gareth wrote: > Hi, > jal <my_function> > li $s2, 3 > li $v0, 2 > > If the jump is not taken, it requires 3 cycles to execute these 3 instructions. > If the jump is taken, it requires 3 cycles to execute the first instruction of > my_function, and li $s2, 3 is executed. > > Is my reasoning correct? > Aside from the corrections Thiemo sent, you should probably also disabuse yourself of the notion that one instruction == one cycle. For most processors, there's no simple answer to the question "how many cycles will this code segment take to run". Even in the embedded world, most newer processors are superscalar. In addition, if you want to be precise, you have to take into account cache behaviour, branch prediction, issue restrictions, etc. -Justin
Attachment:
signature.asc
Description: This is a digitally signed message part