Sun, 27 Jan 2013, 17:30

A student writes:

> Hi,
>  The lab manual states the following
>  "*Also note that BR instruction is assembled as the unconditional branch,
>  BRnzp.*"
>  Is this necessary ?
The short answer: no, it is not necessary.  BR means exactly the same 
thing as BRnzp, which I hope the handouts clearly spell out.   That is, they 
represent two ways for the assembly language programmer to express an 
unconditional branch that both get assembled to the same ISA instruction, 
0000 111 xxxxxxxxx.

Then why have both?  

I included BRnzp because it explicitly tells you all condition codes are 
checked (i.e., branch always), like BRz tells you to check z only.

I included BR since most assembly languages use BR as the unconditional 
branch; i.e., I included it as a convenience for programmers.  

So: necessary, no.  Convenience, yes.

For those who would like BR to mean "check none of the condition codes,"
I can think of a mnemonic that is better than BR for the opcode that says 
"branch based on checking none of the opcodes."  

>  If I understand correctly this would depend on the micro-architecture i.e.
>  what logic is implemented with the nzp bits to check for the condition
>  codes and what does it evaluate to when all are 0s vs all are 1s.

No, it does not depend on anything at the microarchitecture level.  This is
an ISA issue.  ISAs do not depend on what logic is implemented.  It is quite
the opposite.  What logic is implemented depends on what the ISA specifies.

>  Thanks & Regards
>  <<name withheld to protect the student who wants to know if BR is necessary> > 

Hope this helps.  Good luck finishing the first lab by the deadline.

Yale Patt