Shop OBEX P1 Docs P2 Docs Learn Events
instruction format — Parallax Forums

instruction format

Vertex78Vertex78 Posts: 51
edited 2006-12-14 15:36 in Propeller 1
In the Hydra book on page 188 and 189 it shows all the instructions in binary form for the most part. One thing I noticed is that in the execution·condition field of the instruction for all instructions except NOP is 1111 which means always. So other than NOP there are no other instructions that do not use the default value for this field. Are there more instructions that do use this field but are not listed in the table in the hydra book? A second thought I had was that maybe it was up to the programmer to set these bits for whatever reason, but that really wouldn't make any sense since unless there is an optional parameter to the instructions there is no way to modify them. So the only conclusion that I can come up with is that future versions of the propellor chip will have expanded instruction set taking advantage of this field?

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2006-12-14 14:55
    The default condition field is %1111 which is ALWAYS. There is no special NOP instruction. Any instruction with a condition field of %0000 (NEVER) is a NOP. If you want something other than ALWAYS, you have to supply it as described in the Propeller Manual (except for the special case of the opcode NOP which generates a word of all zero).

    Think about it. If you wanted a computer with conditional execution, you would want to apply it to all instructions. You wouldn't want useful instructions to not respond to the condition. You wouldn't be able to use them in some instruction sequences.
  • Vertex78Vertex78 Posts: 51
    edited 2006-12-14 15:09
    I am trying learn the asm language as best as I can by making sense of every detail. I don't understand what you mean by that there is no special NOP instruction. On page 186, it shows NOP as one of the instructions in the assembly instruction set, I understand what you mean by any instruction with a conditional field of %0000 is a NOP. Are you saying since if the condition field is set to %0000 then it doesn't matter what the rest of the fields are it will be a NOP, so the other fields may be set to look like other instructions but since the condition is %0000 then its a NOP, but since there is no certain opcode encoding then there is no special NOP instruction?

    I guess I need to get further along in my study of the assembly code to understand the conditional field for the instructions.
  • Mike GreenMike Green Posts: 23,101
    edited 2006-12-14 15:36
    That's correct. For that matter, whenever the specified condition is false, the rest of the instruction is completely ignored. The NEVER condition is false by definition. Although the assembler provides an opcode for NOP, it is for convenience. Any instruction with a condition of NEVER could be used for this purpose.

    The concept of a conditional field is actually quite simple. In most computers, different branches of execution are usually done with jump instructions. Sometimes jump instructions are implicitly conditional on something (like the TJZ/TJNZ or DJNZ instructions in the Propeller). Sometimes there's an explicit condition that applies only to a jump instruction (like in the Intel 8x86 instruction set). In the Propeller, the condition field exists (and is applied) in all instructions. The main reason is for timing control. In many processors, it's important for things to be as fast as possible, so the number of instructions in each execution branch should be as small as possible and it's not important if the times vary. In the kind of applications that the Propeller is intended for (bit level control of simple hardware), the exact time spent in a loop may be very important regardless of the decisions made in the loop. By using conditional execution, both branches in a two-way decision can be combined with one being executed and the other treated as NOPs. The total time is always the same regardless of the decision made. This can be done in other ways (like adding NOP instructions to the shorter branch), but is easier with conditional instruction execution.
Sign In or Register to comment.