[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [f-cpu] CAS in FC0
hello,
just a quick post before we meet at la Médiathèque :
Christophe wrote:
>
> Oh sorry i didn't read well you email :
>
> "if r4==0 store_locked [r1],r3" is in fact a single instrustion as does "if
> r4==0 jump r0,r63" ?
yes, it is my "version" of the syntax so it appears clearly.
there are usually two conditional intructions : jump and move.
i propose to add another one : store.
> Is that so, okay what I wrote can be shorter :
>
> r1 : pointer, r2 : requested value, r3 : new value
>
> move r2,r4
> move r1,r6
> load_tagged [r1],r2
> xor r2,r4,r1
> if r1 == 0 store_tagged [r6],r3,r1
it can't work because we only have 3 register fields.
This means that if you want to write to a register,
the register number is implicit or something like that.
> jump r0,r63
>
> To push in a FIFO list :
>
> move r2,r3 // our node address to push
> loopentry r5
> load_tagged [r1],r2 // read top
> store r2,[r3] // node->link = top
> if r0 == 0 store_tagged r3,[r1],r4 // top = node
> if r4 == 0 jump r0,r63 // return to caller if ok
> jump r0,r5
same problem.
it seems that we have to better define the conditional store format.
later you corrected yourself :
> oh yes the fields operands is now 4 bad !
>
> well another proposal ?
>
> "if r1 == 0 store_tagged [r2],r3" {
> if (r1 == 0 && !(r1 = (lsu(r2).tag != 1)))
> *r2 = r3;
> }
note : with conditional instructions, we can use whatever
register (even register 0) and 3 conditions (LSB, MSB, zero).
So it is not limited to checking zero :-)
concerning the difference between "lsu(r2).tag == 1"
and "!(r1 = (lsu(r2).tag != 1))", i think i understand.
but i wouldn't write it this way (move the assignation inside
the loop).
> instead of :
>
> "if r1 == 0 store_tagged [r2],r3" {
> if (r1 == 0 && lsu(r2).tag == 1)
> *r2 = r3;
> r3 = (lsu(r2).tag != 1);
> }
WHYGEE
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*************************************************************
To unsubscribe, send an e-mail to majordomo@seul.org with
unsubscribe f-cpu in the body. http://f-cpu.seul.org/