Shop OBEX P1 Docs P2 Docs Learn Events
Suggested change to LINK & LOCADDR instructions — Parallax Forums

Suggested change to LINK & LOCADDR instructions

ozpropdevozpropdev Posts: 2,792
edited 2014-07-16 19:38 in Propeller 2
Hi Chip/All

Looking at the latest instruction set may I make the following suggestion.
If regs 1F2 to 1F7 are named PTR0 to PTR5
1F2	PTR0
1F3	PTR1
1F4	PTR2
1F5	PTR3
1F6	PTR4
1F7	PTR5
1F8	PTRA
1F9	PTRB
1FA	INA
1FB	INB
1FC	OUTA
1FD	OUTB
1FE	DIRA
1FF	DIRB
And the names of the following instructions be changed from
---- wr	*	111000r rrn CCCC nnnnnnnnn nnnnnnnnn		LOCADDR	reg,#abs	adr	(write 19-bit absolute address to $1F2..$1F9, includes PTRA/PTRB)
---- wr	*	111001r rrn CCCC nnnnnnnnn nnnnnnnnn		LOCADDR	reg,@rel	adr	(write 19-bit relative address to $1F2..$1F9, includes PTRA/PTRB)
---- wr	*	111010r rrn CCCC nnnnnnnnn nnnnnnnnn	*	LINK	reg,#abs	adr	(jump to 19-bit absolute address, write {Z,C,P[18:0]} to $1F2..$1F9)
---- wr	*	111011r rrn CCCC nnnnnnnnn nnnnnnnnn	*	LINK	reg,@rel	adr	(jump to 19-bit relative address, write {Z,C,P[18:0]} to $1F2..$1F9)
to
---- wr	*	111000r rrn CCCC nnnnnnnnn nnnnnnnnn		LOCADRx	#abs	
---- wr	*	111001r rrn CCCC nnnnnnnnn nnnnnnnnn		LOCADRx	@rel	
---- wr	*	111010r rrn CCCC nnnnnnnnn nnnnnnnnn	*	LINKx	#abs	
---- wr	*	111011r rrn CCCC nnnnnnnnn nnnnnnnnn	*	LINKx	@rel	

So LOCADDR becomes LOCADR0 .. LOCADR5,LOCADRA and LOCADRB
and LINK becomes LINK0 .. LINK5,LINKA and LINKB

As PTRA/B have special additional indexing abilities the LINKA and LINKB names would help to remind users of
of their potential overlap. Less likely to accidently overwrite PTRA/B values.

While on the subject of PNUT stuff, in the last version we had the Ctrl-G "Get Hardware Version" facility.
Can this be enhanced to include the FPGA build version/release too.
Same for PNUT's "Info" screen to reflect it's version. Based on the history of "ye olde P2" testing it was
sometimes necessary to switch between versions to verify/debug verilog changes.

Thoughts? :)
Cheers
Brian

Comments

  • Bill HenningBill Henning Posts: 6,445
    edited 2014-07-15 15:15
    Sorry, I strongly prefer

    LOCADDR ptr, #/@

    LINK ptr,#/@

    as that only needs two pasm assembly instructions

    BUT

    I like ptr = {PTR0, PTR1, PTR2, PTR3, PTR4, PTR5, PTRA, PTRB}
  • Cluso99Cluso99 Posts: 18,069
    edited 2014-07-15 18:41
    I agree with Bill on this one.

    However, I wonder if it might be prudent to start at $1F3 so we get this...
    1F3 PTR0 
    1F4 PTR1
    1F5 PTR2
    1F6 PTR3
    1F7 PTR4
    1F8 PTRA
    1F9 PTRB
    1FA INA NUL
    1FB INB
    1FC OUTA
    1FD OUTB
    1FE DIRA
    1FF DIRB
    
    This would mean that effectively the last PTR would use INDA which effectively means a JUMP rather than a LINK because a write to INA is ignored.
    So we could do

    LINK NUL,#/@
    which is effectively...
    JMP #/@

    This could save an instruction opcode(s) and perhaps simplify the logic ???

    Perhaps there could be further logic simplification by re-examining all JMP/CALL/RET instructions again ???

    BTW Maybe we should name (predefine in the assembler) all the 1F0-1F7 registers as PTR0-PTR7 and the LOCADR and LINK instructions would use PTR3-PTR7, PTRA, PTRB, NUL.
  • Cluso99Cluso99 Posts: 18,069
    edited 2014-07-15 18:44
    Another pint I have been thinking about is the ACCA/ACCB for the various extended instructions.

    I wonder if they should/could be mapped into the 1F0/1F1 registers ???
    Could there be a benefit where we could then manipulate those values directly with normal instructions such as ADD/SUB/XOR... ???

    Just a thought.
  • ozpropdevozpropdev Posts: 2,792
    edited 2014-07-15 19:55
    @Bill
    The idea behind LINKx and LOCADRx was to keep consistency with existing instruction formats.
    Using the following instructions as an example.
    --MS		100000n nnI CCCC DDDDDDDDD SSSSSSSSS		SETNIBn	D,S/#		mux
    --WS		100001n nnI CCCC DDDDDDDDD SSSSSSSSS		GETNIBn	D,S/#		mux
    --MS		100010n nnI CCCC DDDDDDDDD SSSSSSSSS		ROLNIBn	D,S/#		mux
    --MS		1000110 nnI CCCC DDDDDDDDD SSSSSSSSS		SETBYTn	D,S/#		mux
    --WS		1000111 nnI CCCC DDDDDDDDD SSSSSSSSS		GETBYTn	D,S/#		mux
    --MS		1001000 nnI CCCC DDDDDDDDD SSSSSSSSS		ROLBYTn	D,S/#		mux
    --MS		1001001 0nI CCCC DDDDDDDDD SSSSSSSSS		SETWRDn	D,S/#		mux
    --WS		1001001 1nI CCCC DDDDDDDDD SSSSSSSSS		GETWRDn	D,S/#		mux
    --MS		1001010 0nI CCCC DDDDDDDDD SSSSSSSSS		ROLWRDn	D,S/#		mux
    

    @Ray
    Your mapping idea works too.

    But just giving the registers some official names would be fine. :)
    Cheers
    Brian
  • ozpropdevozpropdev Posts: 2,792
    edited 2014-07-15 21:51
    Cluso99 wrote: »
    Another pint I have been thinking about is the ACCA/ACCB for the various extended instructions.

    I wonder if they should/could be mapped into the 1F0/1F1 registers ???
    Could there be a benefit where we could then manipulate those values directly with normal instructions such as ADD/SUB/XOR... ???

    Just a thought.

    Ray
    What are the ACCA/ACCB that you are referring to?
    I see no reference to these in the latest instruction set.
    Cheers
    Brian
  • Bill HenningBill Henning Posts: 6,445
    edited 2014-07-16 06:59
    Thanks Ray :)

    I'd leave the registers alone, because it might be handy to have six easily loadable pointers - however good point about JMP, because we could just agree on using

    LINK PTR5,#/@

    as JMP, igonoring PTR5 after that if we want. This would still allow saving an op code :)

    However I think it is best if we leave Chip alone at least until we get PNut/FPGA images.

    - For tight pasm code, the four level LIFO stack is great, so we should keep it
    - for hubexec compiled code, the PTRA/PTRB call/ret is fantastic, so we need those

    Perhaps it would be feasible to only keep PTRA call/ret, however there is a certain symmetry in keeping both A/B variants.
    Cluso99 wrote: »
    I agree with Bill on this one.

    However, I wonder if it might be prudent to start at $1F3 so we get this...
    1F3 PTR0 
    1F4 PTR1
    1F5 PTR2
    1F6 PTR3
    1F7 PTR4
    1F8 PTRA
    1F9 PTRB
    1FA INA NUL
    1FB INB
    1FC OUTA
    1FD OUTB
    1FE DIRA
    1FF DIRB
    
    This would mean that effectively the last PTR would use INDA which effectively means a JUMP rather than a LINK because a write to INA is ignored.
    So we could do

    LINK NUL,#/@
    which is effectively...
    JMP #/@

    This could save an instruction opcode(s) and perhaps simplify the logic ???

    Perhaps there could be further logic simplification by re-examining all JMP/CALL/RET instructions again ???

    BTW Maybe we should name (predefine in the assembler) all the 1F0-1F7 registers as PTR0-PTR7 and the LOCADR and LINK instructions would use PTR3-PTR7, PTRA, PTRB, NUL.
  • Cluso99Cluso99 Posts: 18,069
    edited 2014-07-16 19:38
    ozpropdev wrote: »
    Ray
    What are the ACCA/ACCB that you are referring to?
    I see no reference to these in the latest instruction set.
    Cheers
    Brian
    I was thinking about the old cordic instructions that used the accumulators. Not sure how these are going to be implemented atm.
Sign In or Register to comment.