NOP vs WAIT as pipeline fillers
mindrobots
Posts: 6,506
Typically, NOP is used as a pipeline filler if you have nothing productive you can do in that time.
Can a NOPX with appropriate D value be used as a pipeline filler?
Like after a REPD for example, instead of this:
Could end up saving precious COGRAM if it works.
This may not matter because I can't find NOPX (or WAITX) in the latest opcode lists but then NOP isn't in there either. Has NOPX changed to WAIT now?
Anyway, if the instruction still exists would it work to take up the pipeline time without taking up space?
EDIT: NOPX has become WAIT.
Can a NOPX with appropriate D value be used as a pipeline filler?
Like after a REPD for example, instead of this:
REPD D, #1 NOP NOP NOP NOTP #0would this work?
REPD D,#1 NOPX #3 NOTP #0or does it need a physical memory fetch to satisfy the pipeline?
Could end up saving precious COGRAM if it works.
This may not matter because I can't find NOPX (or WAITX) in the latest opcode lists but then NOP isn't in there either. Has NOPX changed to WAIT now?
Anyway, if the instruction still exists would it work to take up the pipeline time without taking up space?
EDIT: NOPX has become WAIT.
Comments
Test with WAIT #xxx It is same as You describe NOPX #3
This is why I think REPD etc need an Assembler fix, so the mnemonic takes two addresses and a count.
(binary opcode is unchanged)
Analog Devices manage their REP opcode this way.
Cool, that's the answer I was looking for! Thanks!
1) It uses the two addresses to auto-generate NOP's
2) Change the opcode to take two addresses, and somehow encode them in the bit pattern
If (1)
then I disagree, as that is three wasted longs - people should Read The Fine Manual.
If (2)
then we have a problem, there are not enough bits in the instruction, and how would the cog skip N ahead?
I think he just means in the assembler/compile. You give it two labels and a count, and if there aren't enough gap instructions it can insert NOPs or give you an error on compile. When compiled it will just use the instruction as it currently is...
We can make the tools be helpful in getting users to the correct results.
100% correct.
No change at all to the binary opcode, just some small checking code in the Assembler, and the source makes it clear where the LOOP is that the user intended, and is 'edit safe'.
Miss, or change, those three gap instructions, and the assembler generates an error.
I'm also fine with allowing an Assembler to Auto-fill if needed, as an option.
It can show what it did in the LST file, and that is 100% compatible with anyone who wants to do all their own gap-packing,
This was done all the time on P1 for the hub window accesses, and it's just not that big of a deal.
EDIT: OK, so Roy is saying that two labels and a count are specified. I think that would be OK, but I would still like to used the REPD instruction as is, just like instructions using ## could be defined explicitly as 2 instructions. So I suggest keeping REPD as it as, and create another instruction name that generates a REPD and checks labels.
This way, only the repeat count is specified (constant or register)
The assembler can figure out how many spacers are needed, if not enough, can add nops + issue warning, if too many, can issue error, and can count number of instructions between LOOP and ENDL
The reason I said to have the RESx line to specify the labels is that it's easier to compile that. The labels also need to be unique per RESx, either via different names or preceding with : (to make them local). When the compiler is doing PASM stuff, it doesn't really handle dependencies on other lines in the source for compiling a given line (other than symbols identified in the first pass, or specially named ones like _RET labels).
Not saying it couldn't be changed to handle this stuff....
Similar to the grey indenting visuals in proptool.
In any case, we can experiment and iterate on this stuff when we get farther along with things.
It should be easy to allow "normal" usage of the instruction as well as "aided" usage.
If we must do it that way, I like this proposal the best so far.
That is the format Analog Devices uses.
To me that is clearer on large code blocks, as generic names do not 'belong' to anything, and a REP with count, also has no clear visual tags of what it will actually DO. It then reads just like a WAIT #Count.
Sure, the REPx opcode can remain, for those who really like counting lines, and running their own syntax checks.
The rest of us, can use simple addresses and let the assembler do the counting, and syntax checks - that's what PC s are for.
May I suggest, if implemented,
Roy will port it, and lots of goodies make sense then, as does using the features in GAS, like macros...
Secondly, keeping Pnut lean means generally good things when it gets ported on chip. The P2 could very well replace the PC for this task when building P3.
Finally, for lack of a standards process, Pnut is the reference implementation, and on that basis really should be as explicit as possible.
A smarter overall assembler, which I think is a really nice to have, is better done one layer up from where we are right now, IMHO.