0
votes

Can someone explain to me first what a conditional statement is? I feel like if I actually know what it is, it would help me understand what else is a conditional statement.

I got this from a website: Alternatively referred to as a conditional expression and conditional processing, a conditional statement is a statement performed if true or false.

Does that mean that beq (Branch equivalent to) is a conditional statement too? Because if you have beq $t0, 1, xx beq $t0, 2, xxx

To me at least, it means if $t0 is equal to 1, go to xx else check if branch is equal to 2, if it is, go to xxx

Is the way I'm reading this correct? If so, does that make beq a conditional statement? To add on that, is all branch syntax considered conditional statements in assembly? bgt , blt, beq, bgez, etc.

I'm sorry I keep asking these questions but my textbook for assembly doesn't tell me anything about conditional statements aside from if and if else, which I know those to be conditional statements only because I was told they were long ago. (Hence I don't know WHY... which is bad, I know. Trying to learn now lol)

1
Your assembly textbook is talking about if-else? get a new book.. - Leeor
I meant it's talking about the translation of if, then, else :p. Converting the syntax from c++ into assembly syntax :p. - Jpyo

1 Answers

0
votes
if $s == $t advance_pc (offset << 2)); else advance_pc (4);
beq $s, $t, offset

http://www.mrc.uidaho.edu/mrc/people/jff/digital/MIPSir.html

Sounds conditional to me!