summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--notes/todo242
-rw-r--r--src/display.rs11
-rw-r--r--src/lib.rs34
-rw-r--r--tests/from_brain.rs67
4 files changed, 227 insertions, 127 deletions
diff --git a/notes/todo b/notes/todo
index d3fe4de..6ae5906 100644
--- a/notes/todo
+++ b/notes/todo
@@ -940,63 +940,6 @@ A L I A S A L I A S A L I A S A L I A S A L I A S | Rd=zxtb(Rs)
-test|1 1 0 0|0 0 1 0|0 - -|s s s s s| P P |- t t t t t|- u u|d d d d d| Rdd=valignb(Rtt,Rss,Pu) - XTYPE PERM/slot 2,3
-test|1 1 0 0|0 0 1 0|1 0 0|s s s s s| P P |- t t t t t|- u u|d d d d d| Rdd=vspliceb(Rss,Rtt,Pu) - XTYPE PERM/slot 2,3
-test|1 1 0 0|0 0 1 0|1 1 0|s s s s s| P P |- t t t t t|- x x|d d d d d| Rdd=add(Rss,Rtt,Px):carry - XTYPE ALU/slot 2,3
-test|1 1 0 0|0 0 1 0|1 1 1|s s s s s| P P |- t t t t t|- x x|d d d d d| Rdd=sub(Rss,Rtt,Px):carry - XTYPE ALU/slot 2,3
-test|1 1 0 0|0 0 1 1|0 0 -|s s s s s| P P |- t t t t t|0 0 -|d d d d d| Rdd=vasrw(Rss,Rt) - XTYPE PERM/slot 2,3
-test|1 1 0 0|0 0 1 1|0 0 -|s s s s s| P P |- t t t t t|0 1 -|d d d d d| Rdd=vlsrw(Rss,Rt) - XTYPE PERM/slot 2,3
-test|1 1 0 0|0 0 1 1|0 0 -|s s s s s| P P |- t t t t t|1 0 -|d d d d d| Rdd=vaslw(Rss,Rt) - XTYPE PERM/slot 2,3
-test|1 1 0 0|0 0 1 1|0 0 -|s s s s s| P P |- t t t t t|1 1 -|d d d d d| Rdd=vlslw(Rss,Rt) - XTYPE PERM/slot 2,3
-test|1 1 0 0|0 0 1 1|0 1 -|s s s s s| P P |- t t t t t|0 0 -|d d d d d| Rdd=vasrh(Rss,Rt) - XTYPE PERM/slot 2,3
-test|1 1 0 0|0 0 1 1|0 1 -|s s s s s| P P |- t t t t t|0 1 -|d d d d d| Rdd=vlsrh(Rss,Rt) - XTYPE PERM/slot 2,3
-test|1 1 0 0|0 0 1 1|0 1 -|s s s s s| P P |- t t t t t|1 0 -|d d d d d| Rdd=vaslh(Rss,Rt) - XTYPE PERM/slot 2,3
-test|1 1 0 0|0 0 1 1|0 1 -|s s s s s| P P |- t t t t t|1 1 -|d d d d d| Rdd=vlslh(Rss,Rt) - XTYPE PERM/slot 2,3
-test|1 1 0 0|0 0 1 1|1 0 -|s s s s s| P P |- i i i i i|0 0 -|d d d d d| Rdd=asr(Rss,Rt) - XTYPE PERM/slot 2,3
-test|1 1 0 0|0 0 1 1|1 0 -|s s s s s| P P |- i i i i i|0 1 -|d d d d d| Rdd=lsr(Rss,Rt) - XTYPE PERM/slot 2,3
-test|1 1 0 0|0 0 1 1|1 0 -|s s s s s| P P |- i i i i i|1 0 -|d d d d d| Rdd=asl(Rss,Rt) - XTYPE PERM/slot 2,3
-test|1 1 0 0|0 0 1 1|1 0 -|s s s s s| P P |- i i i i i|1 1 -|d d d d d| Rdd=lsl(Rss,Rt) - XTYPE PERM/slot 2,3
-test|1 1 0 0|0 0 1 1|1 1 -|s s s s s| P P |- t t t t t|0 0 -|d d d d d| Rdd=vcrotate(Rss,Rt) - XTYPE COMPLEX/slot 2,3
-test|1 1 0 0|0 0 1 1|1 1 -|s s s s s| P P |- t t t t t|0 1 -|d d d d d| Rdd=vcnegh(Rss,Rt) - XTYPE ALU/slot 2,3
-test|1 1 0 0|0 0 1 1|1 1 -|s s s s s| P P |i t t t t t|1 1 i|d d d d d| Rdd=vrcrotate(Rss,Rt,#u2) - XTYPE COMPLEX/slot 2,3
-test|1 1 0 0|0 1 0 0|0 0 0|s s s s s| P P |0 t t t t t|i i i|d d d d d| Rd=addasl(Rt,Rs,#u3) - XTYPE PERM/slot 2,3
-test|1 1 0 0|0 1 0 1|- - -|s s s s s| P P |- t t t t t|0 1 0|d d d d d| Rd=vasrw(Rss,Rt) - XTYPE PERM/slot 2,3
-test|1 1 0 0|0 1 0 1|- - -|s s s s s| P P |- t t t t t|1 0 0|d d d d d| Rd=cmpyiwh(Rss,Rt):<<1:rnd:sat - XTYPE COMPLEX/slot 2,3
-test|1 1 0 0|0 1 0 1|- - -|s s s s s| P P |- t t t t t|1 0 1|d d d d d| Rd=cmpyiwh(Rss,Rt*):<<1:rnd:sat - XTYPE COMPLEX/slot 2,3
-test|1 1 0 0|0 1 0 1|- - -|s s s s s| P P |- t t t t t|1 1 0|d d d d d| Rd=cmpyrwh(Rss,Rt):<<1:rnd:sat - XTYPE COMPLEX/slot 2,3
-test|1 1 0 0|0 1 0 1|- - -|s s s s s| P P |- t t t t t|1 1 1|d d d d d| Rd=cmpyrwh(Rss,Rt*):<<1:rnd:sat - XTYPE COMPLEX/slot 2,3
-test|1 1 0 0|0 1 1 0|0 0 -|s s s s s| P P |- t t t t t|0 0 -|d d d d d| Rd=asr(Rs,Rt):sat - XTYPE PERM/slot 2,3
-test|1 1 0 0|0 1 1 0|0 0 -|s s s s s| P P |- t t t t t|1 0 -|d d d d d| Rd=asl(Rs,Rt):sat - XTYPE PERM/slot 2,3
-test|1 1 0 0|0 1 1 0|0 1 -|s s s s s| P P |- i i i i i|0 0 -|d d d d d| Rd=asr(Rs,Rt) - XTYPE PERM/slot 2,3
-test|1 1 0 0|0 1 1 0|0 1 -|s s s s s| P P |- i i i i i|0 1 -|d d d d d| Rd=lsr(Rs,Rt) - XTYPE PERM/slot 2,3
-test|1 1 0 0|0 1 1 0|0 1 -|s s s s s| P P |- i i i i i|1 0 -|d d d d d| Rd=asl(Rs,Rt) - XTYPE PERM/slot 2,3
-test|1 1 0 0|0 1 1 0|0 1 -|s s s s s| P P |- i i i i i|1 1 -|d d d d d| Rd=lsl(Rs,Rt) - XTYPE PERM/slot 2,3
-test|1 1 0 0|0 1 1 0|1 0 -|i i i i i| P P |- t t t t t|1 1 i|d d d d d| Rd=lsl(#s6,Rt) - XTYPE PERM/slot 2,3
-test|1 1 0 0|0 1 1 0|1 1 -|s s s s s| P P |- t t t t t|0 0 -|d d d d d| Rd=cround(Rs,Rt) - XTYPE ALU/slot 2,3
-test|1 1 0 0|0 1 1 0|1 1 -|s s s s s| P P |- t t t t t|0 1 -|d d d d d| Rdd=cround(Rss,Rt) - XTYPE ALU/slot 2,3
-test|1 1 0 0|0 1 1 0|1 1 -|s s s s s| P P |- t t t t t|1 0 -|d d d d d| Rd=round(Rs,Rt) - XTYPE ALU/slot 2,3
-test|1 1 0 0|0 1 1 0|1 1 -|s s s s s| P P |- t t t t t|1 1 -|d d d d d| Rd=round(Rs,Rt):sat - XTYPE ALU/slot 2,3
-test|1 1 0 0|0 1 1 1|0 0 0|s s s s s| P P |- i i i i i|- - -|- - - d d| Pd=tstbit(Rs,Rt) - XTYPE PERM/slot 2,3
-test|1 1 0 0|0 1 1 1|0 0 1|s s s s s| P P |- i i i i i|- - -|- - - d d| Pd=!tstbit(Rs,Rt) - XTYPE PERM/slot 2,3
-test|1 1 0 0|0 1 1 1|0 1 0|s s s s s| P P |- t t t t t|- - -|- - - d d| Pd=bitsset(Rs,Rt) - XTYPE PERM/slot 2,3
-test|1 1 0 0|0 1 1 1|0 1 1|s s s s s| P P |- t t t t t|- - -|- - - d d| Pd=!bitsset(Rs,Rt) - XTYPE PERM/slot 2,3
-test|1 1 0 0|0 1 1 1|1 0 0|s s s s s| P P |- t t t t t|- - -|- - - d d| Pd=bitsclr(Rs,Rt) - XTYPE PERM/slot 2,3
-test|1 1 0 0|0 1 1 1|1 0 1|s s s s s| P P |- t t t t t|- - -|- - - d d| Pd=!bitsclr(Rs,Rt) - XTYPE PERM/slot 2,3
-test|1 1 0 0|0 1 1 1|1 1 0|s s s s s| P P |- t t t t t|0 1 0|- - - d d| Pd=cmpb.gt(Rs,Rt) - XTYPE PERM/slot 2,3
-test|1 1 0 0|0 1 1 1|1 1 0|s s s s s| P P |- t t t t t|0 1 1|- - - d d| Pd=cmph.gt(Rs,Rt) - XTYPE PERM/slot 2,3
-test|1 1 0 0|0 1 1 1|1 1 0|s s s s s| P P |- t t t t t|1 0 0|- - - d d| Pd=cmph.eq(Rs,Rt) - XTYPE PERM/slot 2,3
-test|1 1 0 0|0 1 1 1|1 1 0|s s s s s| P P |- t t t t t|1 0 1|- - - d d| Pd=cmph.gtu(Rs,Rt) - XTYPE PERM/slot 2,3
-test|1 1 0 0|0 1 1 1|1 1 0|s s s s s| P P |- t t t t t|1 1 0|- - - d d| Pd=cmpb.eq(Rs,Rt) - XTYPE PERM/slot 2,3
-test|1 1 0 0|0 1 1 1|1 1 0|s s s s s| P P |- t t t t t|1 1 1|- - - d d| Pd=cmpb.gtu(Rs,Rt) - XTYPE PERM/slot 2,3
-test|1 1 0 0|0 1 1 1|1 1 1|s s s s s| P P |- t t t t t|0 0 0|- - - d d| Pd=sfcmp.ge(Rs,Rt) - XTYPE FP/slot 2,3
-test|1 1 0 0|0 1 1 1|1 1 1|s s s s s| P P |- t t t t t|0 0 1|- - - d d| Pd=sfcmp.uo(Rs,Rt) - XTYPE FP/slot 2,3
-test|1 1 0 0|0 1 1 1|1 1 1|s s s s s| P P |- t t t t t|0 1 1|- - - d d| Pd=sfcmp.eq(Rs,Rt) - XTYPE FP/slot 2,3
-test|1 1 0 0|0 1 1 1|1 1 1|s s s s s| P P |- t t t t t|1 0 0|- - - d d| Pd=sfcmp.gt(Rs,Rt) - XTYPE FP/slot 2,3
-test|1 1 0 0|1 0 0 0|- - -|s s s s s| P P |- t t t t t|- - -|x x x x x| Rx=insert(Rs,Rtt) - XTYPE ALU/slot 2,3
-test|1 1 0 0|1 0 0 1|1 1 -|s s s s s| P P |- t t t t t|0 0 -|d d d d d| Rd=extractu(Rs,Rtt) - XTYPE ALU/slot 2,3
-test|1 1 0 0|1 0 0 1|1 1 -|s s s s s| P P |- t t t t t|0 1 -|d d d d d| Rd=extract(Rs,Rtt) - XTYPE ALU/slot 2,3
-test|1 1 0 0|1 0 1 0|0 - -|s s s s s| P P |0 t t t t t|- - -|x x x x x| Rxx=insert(Rss,Rtt) - XTYPE ALU/slot 2,3
-test|1 1 0 0|1 0 1 0|1 0 -|s s s s s| P P |0 t t t t t|0 0 0|x x x x x| Rxx^=xor(Rss,Rtt) - XTYPE ALU/slot 2,3
@@ -1161,70 +1104,127 @@ test|1 1 0 0|1 0 1 0|1 0 -|s s s s s| P P |0 t t t t t|0 0 0|x x x x x| Rxx^=xor
-test|1 1 0 1|1 0 0 1|0 0 i|- - - - -| P P |i i i i i i|i i i|d d d d d| Rdd=dfmake(#u10):pos - XTYPE FP/slot 2,3
-test|1 1 0 1|1 0 0 1|0 1 i|- - - - -| P P |i i i i i i|i i i|d d d d d| Rdd=dfmake(#u10):neg - XTYPE FP/slot 2,3
-test|1 1 0 1|1 0 1 0|0 0 i|s s s s s| P P |i i i i i i|i i i|x x x x x| Rx|=and(Rs,#s10) - XTYPE ALU/slot 2,3
-test|1 1 0 1|1 0 1 0|0 1 i|x x x x x| P P |i i i i i i|i i i|u u u u u| Rx=or(Ru,and(Rx,#s10)) - XTYPE ALU/slot 2,3
-test|1 1 0 1|1 0 1 0|1 0 i|s s s s s| P P |i i i i i i|i i i|x x x x x| Rx|=or(Rs,#s10) - XTYPE ALU/slot 2,3
-test|1 1 0 1|1 0 1 1|0 i i|s s s s s| P P |i d d d d d|i i i|u u u u u| Rd=add(Rs,add(Ru,#s6)) - XTYPE ALU/slot 2,3
-test|1 1 0 1|1 0 1 1|1 i i|s s s s s| P P |i d d d d d|i i i|u u u u u| Rd=add(Rs,sub(#s6,Ru)) - XTYPE ALU/slot 2,3
-test|1 1 0 1|1 1 0 0|0 0 0|s s s s s| P P |- i i i i i|i i i|0 0 - d d| Pd=vcmpb.eq(Rss,#s8) - XTYPE PERM/slot 2,3
-test|1 1 0 1|1 1 0 0|0 0 0|s s s s s| P P |- i i i i i|i i i|0 1 - d d| Pd=vcmph.eq(Rss,#s8) - XTYPE PERM/slot 2,3
-test|1 1 0 1|1 1 0 0|0 0 0|s s s s s| P P |- i i i i i|i i i|1 0 - d d| Pd=vcmpw.eq(Rss,#s8) - XTYPE PERM/slot 2,3
-test|1 1 0 1|1 1 0 0|0 0 1|s s s s s| P P |- i i i i i|i i i|0 0 - d d| Pd=vcmpb.gt(Rss,#s8) - XTYPE PERM/slot 2,3
-test|1 1 0 1|1 1 0 0|0 0 1|s s s s s| P P |- i i i i i|i i i|0 1 - d d| Pd=vcmph.gt(Rss,#s8) - XTYPE PERM/slot 2,3
-test|1 1 0 1|1 1 0 0|0 0 1|s s s s s| P P |- i i i i i|i i i|1 0 - d d| Pd=vcmpw.gt(Rss,#s8) - XTYPE PERM/slot 2,3
-test|1 1 0 1|1 1 0 0|0 1 0|s s s s s| P P |- 0 i i i i|i i i|0 0 - d d| Pd=vcmpb.gtu(Rss,#u7) - XTYPE PERM/slot 2,3
-test|1 1 0 1|1 1 0 0|0 1 0|s s s s s| P P |- 0 i i i i|i i i|0 1 - d d| Pd=vcmph.gtu(Rss,#u7) - XTYPE PERM/slot 2,3
-test|1 1 0 1|1 1 0 0|0 1 0|s s s s s| P P |- 0 i i i i|i i i|1 0 - d d| Pd=vcmpw.gtu(Rss,#u7) - XTYPE PERM/slot 2,3
-test|1 1 0 1|1 1 0 0|1 0 0|s s s s s| P P |- 0 0 0 i i|i i i|1 0 - d d| Pd=dfclass(Rss,#u5) - XTYPE FP/slot 2,3
-test|1 1 0 1|1 1 0 1|- 0 0|s s s s s| P P |- i i i i i|i i i|0 0 - d d| Pd=cmpb.gt(Rs,#u8) - XTYPE PERM/slot 2,3
-test|1 1 0 1|1 1 0 1|- 0 0|s s s s s| P P |- i i i i i|i i i|0 1 - d d| Pd=cmph.gt(Rs,#u8) - XTYPE PERM/slot 2,3
-test|1 1 0 1|1 1 0 1|- 0 1|s s s s s| P P |- i i i i i|i i i|0 0 - d d| Pd=cmpb.eq(Rs,#s8) - XTYPE PERM/slot 2,3
-test|1 1 0 1|1 1 0 1|- 0 1|s s s s s| P P |- i i i i i|i i i|0 1 - d d| Pd=cmph.eq(Rs,#s8) - XTYPE PERM/slot 2,3
-test|1 1 0 1|1 1 0 1|- 1 0|s s s s s| P P |- 0 i i i i|i i i|0 0 - d d| Pd=cmpb.gtu(Rs,#u7) - XTYPE PERM/slot 2,3
-test|1 1 0 1|1 1 0 1|- 1 0|s s s s s| P P |- 0 i i i i|i i i|0 1 - d d| Pd=cmph.gtu(Rs,#u7) - XTYPE PERM/slot 2,3
-test|1 1 0 1|1 1 1 0|i i i|x x x x x| P P |i l l l l l|i i i|0 i 0 0 -| Rx=and(#u8,asl(Rx,#U5)) - XTYPE PERM/slot 2,3
-test|1 1 0 1|1 1 1 0|i i i|x x x x x| P P |i l l l l l|i i i|0 i 0 1 -| Rx=or(#u8,asl(Rx,#U5)) - XTYPE PERM/slot 2,3
-test|1 1 0 1|1 1 1 0|i i i|x x x x x| P P |i l l l l l|i i i|0 i 1 0 -| Rx=add(#u8,asl(Rx,#U5)) - XTYPE PERM/slot 2,3
-test|1 1 0 1|1 1 1 0|i i i|x x x x x| P P |i l l l l l|i i i|0 i 1 1 -| Rx=sub(#u8,asl(Rx,#U5)) - XTYPE PERM/slot 2,3
-test|1 1 0 1|1 1 1 0|i i i|x x x x x| P P |i l l l l l|i i i|1 i 0 0 -| Rx=and(#u8,lsr(Rx,#U5)) - XTYPE PERM/slot 2,3
-test|1 1 0 1|1 1 1 0|i i i|x x x x x| P P |i l l l l l|i i i|1 i 0 1 -| Rx=or(#u8,lsr(Rx,#U5)) - XTYPE PERM/slot 2,3
-test|1 1 0 1|1 1 1 0|i i i|x x x x x| P P |i l l l l l|i i i|1 i 1 0 -| Rx=add(#u8,lsr(Rx,#U5)) - XTYPE PERM/slot 2,3
-test|1 1 0 1|1 1 1 0|i i i|x x x x x| P P |i l l l l l|i i i|1 i 1 1 -| Rx=sub(#u8,lsr(Rx,#U5)) - XTYPE PERM/slot 2,3
-test|1 1 0 1|1 1 1 1|0 i i|s s s s s| P P |i d d d d d|i i i|u u u u u| Rd=add(Ru,mpyi(#u6:2,Rs)) - XTYPE FP/slot 2,3
-test|1 1 0 1|1 1 1 1|1 i i|s s s s s| P P |i d d d d d|i i i|u u u u u| Rd=add(Ru,mpyi(Rs,#u6)) - XTYPE FP/slot 2,3
-test|1 1 1 0|0 0 0 0|0 - -|s s s s s| P P |0 i i i i i|i i i|d d d d d| Rd=+mpyi(Rs,#u8) - XTYPE FP/slot 2,3
-test|1 1 1 0|0 0 0 0|1 - -|s s s s s| P P |0 i i i i i|i i i|d d d d d| Rd=-mpyi(Rs,#u8) - XTYPE FP/slot 2,3
-test|1 1 1 0|0 0 0 1|0 - -|s s s s s| P P |0 i i i i i|i i i|x x x x x| Rx+=mpyi(Rs,#u8) - XTYPE FP/slot 2,3
-test|1 1 1 0|0 0 0 1|1 - -|s s s s s| P P |0 i i i i i|i i i|x x x x x| Rx-=mpyi(Rs,#u8) - XTYPE FP/slot 2,3
-test|1 1 1 0|0 0 1 0|0 - -|s s s s s| P P |0 i i i i i|i i i|x x x x x| Rx+=add(Rs,#s8) - XTYPE ALU/slot 2,3
-test|1 1 1 0|0 0 1 0|1 - -|s s s s s| P P |0 i i i i i|i i i|x x x x x| Rx-=add(Rs,#s8) - XTYPE ALU/slot 2,3
-test|1 1 1 0|0 0 1 1|0 0 0|s s s s s| P P |- y y y y y|- - -|u u u u u| Ry=add(Ru,mpyi(Ry,Rs)) - XTYPE FP/slot 2,3
-test|1 1 1 0|0 1 0 0|N 0 0|s s s s s| P P |- t t t t t|- 0 0|d d d d d| Rdd=mpy(Rs.L,Rt.L)[:<<N] - XTYPE FP/slot 2,3
-test|1 1 1 0|0 1 0 0|N 0 0|s s s s s| P P |- t t t t t|- 0 1|d d d d d| Rdd=mpy(Rs.L,Rt.H)[:<<N] - XTYPE FP/slot 2,3
-test|1 1 1 0|0 1 0 0|N 0 0|s s s s s| P P |- t t t t t|- 1 0|d d d d d| Rdd=mpy(Rs.H,Rt.L)[:<<N] - XTYPE FP/slot 2,3
-test|1 1 1 0|0 1 0 0|N 0 0|s s s s s| P P |- t t t t t|- 1 1|d d d d d| Rdd=mpy(Rs.H,Rt.H)[:<<N] - XTYPE FP/slot 2,3
-test|1 1 1 0|0 1 0 0|N 0 1|s s s s s| P P |- t t t t t|- 0 0|d d d d d| Rdd=mpy(Rs.L,Rt.L)[:<<N]:rnd - XTYPE FP/slot 2,3
-test|1 1 1 0|0 1 0 0|N 0 1|s s s s s| P P |- t t t t t|- 0 1|d d d d d| Rdd=mpy(Rs.L,Rt.H)[:<<N]:rnd - XTYPE FP/slot 2,3
-test|1 1 1 0|0 1 0 0|N 0 1|s s s s s| P P |- t t t t t|- 1 0|d d d d d| Rdd=mpy(Rs.H,Rt.L)[:<<N]:rnd - XTYPE FP/slot 2,3
-test|1 1 1 0|0 1 0 0|N 0 1|s s s s s| P P |- t t t t t|- 1 1|d d d d d| Rdd=mpy(Rs.H,Rt.H)[:<<N]:rnd - XTYPE FP/slot 2,3
-test|1 1 1 0|0 1 0 0|N 1 0|s s s s s| P P |- t t t t t|- 0 0|d d d d d| Rdd=mpyu(Rs.L,Rt.L)[:<<N] - XTYPE FP/slot 2,3
-test|1 1 1 0|0 1 0 0|N 1 0|s s s s s| P P |- t t t t t|- 0 1|d d d d d| Rdd=mpyu(Rs.L,Rt.H)[:<<N] - XTYPE FP/slot 2,3
-test|1 1 1 0|0 1 0 0|N 1 0|s s s s s| P P |- t t t t t|- 1 0|d d d d d| Rdd=mpyu(Rs.H,Rt.L)[:<<N] - XTYPE FP/slot 2,3
-test|1 1 1 0|0 1 0 0|N 1 0|s s s s s| P P |- t t t t t|- 1 1|d d d d d| Rdd=mpyu(Rs.H,Rt.H)[:<<N] - XTYPE FP/slot 2,3
-test|1 1 1 0|0 1 0 1|0 0 0|s s s s s| P P |0 t t t t t|0 0 0|d d d d d| Rdd=mpy(Rs,Rt) - XTYPE FP/slot 2,3
-test|1 1 1 0|0 1 0 1|0 0 0|s s s s s| P P |0 t t t t t|0 0 1|d d d d d| Rdd=cmpyi(Rs,Rt) - XTYPE COMPLEX/slot 2,3
-test|1 1 1 0|0 1 0 1|0 0 0|s s s s s| P P |0 t t t t t|0 1 0|d d d d d| Rdd=cmpyr(Rs,Rt) - XTYPE COMPLEX/slot 2,3
-test|1 1 1 0|0 1 0 1|0 1 0|s s s s s| P P |0 t t t t t|0 0 0|d d d d d| Rdd=mpyu(Rs,Rt) - XTYPE FP/slot 2,3
-test|1 1 1 0|0 1 0 1|0 1 0|s s s s s| P P |0 t t t t t|0 0 1|d d d d d| Rdd=vmpybsu(Rs,Rt) - XTYPE FP/slot 2,3
-test|1 1 1 0|0 1 0 1|0 1 0|s s s s s| P P |0 t t t t t|1 1 1|d d d d d| Rdd=pmpyw(Rs,Rt) - XTYPE FP/slot 2,3
-test|1 1 1 0|0 1 0 1|1 0 0|s s s s s| P P |0 t t t t t|0 0 1|d d d d d| Rdd=vmpybu(Rs,Rt) - XTYPE FP/slot 2,3
-test|1 1 1 0|0 1 0 1|1 1 0|s s s s s| P P |0 t t t t t|1 1 1|d d d d d| Rdd=vpmpyh(Rs,Rt) - XTYPE FP/slot 2,3
-test|1 1 1 0|0 1 0 1|N 0 0|s s s s s| P P |0 t t t t t|1 0 1|d d d d d| Rdd=vmpyh(Rss,Rtt)[:<<N]:sat - XTYPE FP/slot 2,3
-test|1 1 1 0|0 1 0 1|N 0 0|s s s s s| P P |0 t t t t t|1 1 0|d d d d d| Rdd=cmpy(Rs,Rt)[:<<N]:sat - XTYPE COMPLEX/slot 2,3
-test|1 1 1 0|0 1 0 1|N 0 0|s s s s s| P P |0 t t t t t|1 1 1|d d d d d| Rdd=vmpyhsu(Rs,Rt)[:<<N]:sat - XTYPE FP/slot 2,3
-test|1 1 1 0|0 1 0 1|N 1 0|s s s s s| P P |0 t t t t t|1 1 0|d d d d d| Rdd=cmpy(Rs,Rt*)[:<<N]:sat - XTYPE COMPLEX/slot 2,3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
test|1 1 1 0|0 1 1 0|N 0 0|s s s s s| P P |- t t t t t|0 0 0|x x x x x| Rxx+=mpy(Rs.L,Rt.L)[:<<N] - XTYPE FP/slot 2,3
test|1 1 1 0|0 1 1 0|N 0 0|s s s s s| P P |- t t t t t|0 0 1|x x x x x| Rxx+=mpy(Rs.L,Rt.H)[:<<N] - XTYPE FP/slot 2,3
test|1 1 1 0|0 1 1 0|N 0 0|s s s s s| P P |- t t t t t|0 1 0|x x x x x| Rxx+=mpy(Rs.H,Rt.L)[:<<N] - XTYPE FP/slot 2,3
diff --git a/src/display.rs b/src/display.rs
index f2b0e51..fc4fd3a 100644
--- a/src/display.rs
+++ b/src/display.rs
@@ -119,6 +119,14 @@ impl fmt::Display for Instruction {
return write!(f, "{} = add({}, mpyi({}, {}))", self.dest.as_ref().unwrap(),
self.sources[0], self.sources[1], self.sources[2]);
},
+ Opcode::MpyiPos => {
+ return write!(f, "{} = +mpyi({}, {})", self.dest.as_ref().unwrap(),
+ self.sources[0], self.sources[1]);
+ },
+ Opcode::MpyiNeg => {
+ return write!(f, "{} = -mpyi({}, {})", self.dest.as_ref().unwrap(),
+ self.sources[0], self.sources[1]);
+ },
Opcode::AddClb => {
return write!(f, "{} = add(clb({}), {})", self.dest.as_ref().unwrap(),
self.sources[0], self.sources[1]);
@@ -636,7 +644,8 @@ impl fmt::Display for Opcode {
Opcode::Vnegh => { f.write_str("vnegh") },
Opcode::Vcnegh => { f.write_str("vcnegh") },
- Opcode:: Pmpyw => { f.write_str("pmpyw") },
+ Opcode::Pmpyw => { f.write_str("pmpyw") },
+ Opcode::Vpmpyh => { f.write_str("vpmpyh") },
Opcode::Lfs => { f.write_str("lfs") },
Opcode:: Vxaddsubh => { f.write_str("vxaddsubh") },
diff --git a/src/lib.rs b/src/lib.rs
index fc82124..7ca9d8d 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -611,6 +611,7 @@ pub enum Opcode {
Vrmpyh,
Pmpyw,
+ Vpmpyh,
Lfs,
Vxaddsubh,
@@ -1464,6 +1465,11 @@ impl<T: yaxpeax_arch::Reader<<Hexagon as Arch>::Address, <Hexagon as Arch>::Word
let flags = &mut self.instructions[self.instruction_count as usize].flags;
assert!(flags.shift_left.is_none());
assert!(flags.shift_right.is_none());
+ // if the result would be shifted by zero, ignore it so as to not print
+ // <<0 when rendering the instruction.
+ if shiftamt == 0 {
+ return Ok(());
+ }
flags.shift_left = Some(shiftamt);
Ok(())
}
@@ -1471,6 +1477,11 @@ impl<T: yaxpeax_arch::Reader<<Hexagon as Arch>::Address, <Hexagon as Arch>::Word
let flags = &mut self.instructions[self.instruction_count as usize].flags;
assert!(flags.shift_left.is_none());
assert!(flags.shift_right.is_none());
+ // if the result would be shifted by zero, ignore it so as to not print
+ // >>0 when rendering the instruction.
+ if shiftamt == 0 {
+ return Ok(());
+ }
flags.shift_right = Some(shiftamt);
Ok(())
}
@@ -5682,6 +5693,11 @@ fn decode_instruction<
handler.on_dest_decoded(Operand::gpr(reg_b0(inst)))?;
handler.on_source_decoded(Operand::gpr(sssss))?;
handler.on_source_decoded(Operand::imm_i8(i as i8))?;
+ if op_hi < 0b100 {
+ handler.assign_mode(AssignMode::AddAssign)?;
+ } else {
+ handler.assign_mode(AssignMode::SubAssign)?;
+ }
}
0b0011 => {
let uuuuu = reg_b0(inst);
@@ -5722,7 +5738,10 @@ fn decode_instruction<
handler.on_source_decoded(Operand::gpr_high(ttttt))?;
}
- handler.shift_left((op_hi >> 2) & 1)?;
+ let shift = (op_hi >> 2) & 1;
+ if shift != 0 {
+ handler.shift_left(shift)?;
+ }
}
0b0101 => {
// some more mpy
@@ -5736,7 +5755,10 @@ fn decode_instruction<
handler.on_opcode_decoded(Opcode::Vmpyh)?;
handler.on_source_decoded(Operand::gprpair(sssss)?)?;
handler.on_source_decoded(Operand::gprpair(ttttt)?)?;
- handler.shift_left((opc >> 5) as u8)?;
+ let shift = opc >> 5;
+ if shift != 0 {
+ handler.shift_left((opc >> 5) as u8)?;
+ }
handler.saturate()?;
return Ok(());
}
@@ -5765,14 +5787,16 @@ fn decode_instruction<
handler.on_source_decoded(Operand::gpr(ttttt))?;
+ eprintln!("opc: {:05b}", opc);
+
static OPCODES: [Option<Opcode>; 64] = [
Some(Mpy), Some(Cmpyi), Some(Cmpyr), None, None, None, None, None,
- Some(Mpyu), Some(Vmpybsu), None, Some(Pmpyw), None, None, None, None,
None, None, None, None, None, None, None, None,
- None, Some(Vmpybu), None, None, None, None, None, None,
+ Some(Mpyu), Some(Vmpybsu), None, None, None, None, None, Some(Pmpyw),
None, None, None, None, None, None, None, None,
- None, None, None, None, None, None, None, Some(Vmpyh),
+ None, Some(Vmpybu), None, None, None, None, None, None,
None, None, None, None, None, None, None, None,
+ None, None, None, None, None, None, None, Some(Vpmpyh),
None, None, None, None, None, None, None, None,
];
diff --git a/tests/from_brain.rs b/tests/from_brain.rs
index abaef4f..f98ca03 100644
--- a/tests/from_brain.rs
+++ b/tests/from_brain.rs
@@ -1417,6 +1417,73 @@ fn inst_1101() {
}
#[test]
+fn inst_1110() {
+ test_display(&0b1110_0000_000_10100_11_000110_100_10110u32.to_le_bytes(), "{ R22 = +mpyi(R20, #0x34) }");
+ test_display(&0b1110_0000_100_10100_11_000110_100_10110u32.to_le_bytes(), "{ R22 = -mpyi(R20, #0x34) }");
+ test_display(&0b1110_0001_000_10100_11_000110_100_10110u32.to_le_bytes(), "{ R22 += mpyi(R20, #0x34) }");
+ test_display(&0b1110_0001_100_10100_11_000110_100_10110u32.to_le_bytes(), "{ R22 -= mpyi(R20, #0x34) }");
+ test_display(&0b1110_0010_000_10100_11_000110_100_10110u32.to_le_bytes(), "{ R22 += add(R20, #52) }");
+ test_display(&0b1110_0010_100_10100_11_000110_100_10110u32.to_le_bytes(), "{ R22 -= add(R20, #52) }");
+ test_display(&0b1110_0011_000_10100_11_000110_100_10110u32.to_le_bytes(), "{ R6 = add(R22, mpyi(R6, R20)) }");
+
+ test_display(&0b1110_0100_000_10100_11_000110_100_10110u32.to_le_bytes(), "{ R23:22 = mpy(R20.L, R6.L) }");
+ test_display(&0b1110_0100_100_10100_11_000110_100_10110u32.to_le_bytes(), "{ R23:22 = mpy(R20.L, R6.L):<<1 }");
+ test_display(&0b1110_0100_000_10100_11_000110_101_10110u32.to_le_bytes(), "{ R23:22 = mpy(R20.L, R6.H) }");
+ test_display(&0b1110_0100_100_10100_11_000110_101_10110u32.to_le_bytes(), "{ R23:22 = mpy(R20.L, R6.H):<<1 }");
+ test_display(&0b1110_0100_000_10100_11_000110_110_10110u32.to_le_bytes(), "{ R23:22 = mpy(R20.H, R6.L) }");
+ test_display(&0b1110_0100_100_10100_11_000110_110_10110u32.to_le_bytes(), "{ R23:22 = mpy(R20.H, R6.L):<<1 }");
+ test_display(&0b1110_0100_000_10100_11_000110_111_10110u32.to_le_bytes(), "{ R23:22 = mpy(R20.H, R6.H) }");
+ test_display(&0b1110_0100_100_10100_11_000110_111_10110u32.to_le_bytes(), "{ R23:22 = mpy(R20.H, R6.H):<<1 }");
+
+ test_display(&0b1110_0100_001_10100_11_000110_100_10110u32.to_le_bytes(), "{ R23:22 = mpy(R20.L, R6.L):rnd }");
+ test_display(&0b1110_0100_101_10100_11_000110_100_10110u32.to_le_bytes(), "{ R23:22 = mpy(R20.L, R6.L):<<1:rnd }");
+ test_display(&0b1110_0100_001_10100_11_000110_101_10110u32.to_le_bytes(), "{ R23:22 = mpy(R20.L, R6.H):rnd }");
+ test_display(&0b1110_0100_101_10100_11_000110_101_10110u32.to_le_bytes(), "{ R23:22 = mpy(R20.L, R6.H):<<1:rnd }");
+ test_display(&0b1110_0100_001_10100_11_000110_110_10110u32.to_le_bytes(), "{ R23:22 = mpy(R20.H, R6.L):rnd }");
+ test_display(&0b1110_0100_101_10100_11_000110_110_10110u32.to_le_bytes(), "{ R23:22 = mpy(R20.H, R6.L):<<1:rnd }");
+ test_display(&0b1110_0100_001_10100_11_000110_111_10110u32.to_le_bytes(), "{ R23:22 = mpy(R20.H, R6.H):rnd }");
+ test_display(&0b1110_0100_101_10100_11_000110_111_10110u32.to_le_bytes(), "{ R23:22 = mpy(R20.H, R6.H):<<1:rnd }");
+
+ test_display(&0b1110_0100_010_10100_11_000110_100_10110u32.to_le_bytes(), "{ R23:22 = mpyu(R20.L, R6.L) }");
+ test_display(&0b1110_0100_110_10100_11_000110_100_10110u32.to_le_bytes(), "{ R23:22 = mpyu(R20.L, R6.L):<<1 }");
+ test_display(&0b1110_0100_010_10100_11_000110_101_10110u32.to_le_bytes(), "{ R23:22 = mpyu(R20.L, R6.H) }");
+ test_display(&0b1110_0100_110_10100_11_000110_101_10110u32.to_le_bytes(), "{ R23:22 = mpyu(R20.L, R6.H):<<1 }");
+ test_display(&0b1110_0100_010_10100_11_000110_110_10110u32.to_le_bytes(), "{ R23:22 = mpyu(R20.H, R6.L) }");
+ test_display(&0b1110_0100_110_10100_11_000110_110_10110u32.to_le_bytes(), "{ R23:22 = mpyu(R20.H, R6.L):<<1 }");
+ test_display(&0b1110_0100_010_10100_11_000110_111_10110u32.to_le_bytes(), "{ R23:22 = mpyu(R20.H, R6.H) }");
+ test_display(&0b1110_0100_110_10100_11_000110_111_10110u32.to_le_bytes(), "{ R23:22 = mpyu(R20.H, R6.H):<<1 }");
+
+ test_invalid(&0b1110_0100_011_10100_11_000110_100_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
+ test_invalid(&0b1110_0100_111_10100_11_000110_100_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
+ test_invalid(&0b1110_0100_011_10100_11_000110_101_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
+ test_invalid(&0b1110_0100_111_10100_11_000110_101_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
+ test_invalid(&0b1110_0100_011_10100_11_000110_110_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
+ test_invalid(&0b1110_0100_111_10100_11_000110_110_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
+ test_invalid(&0b1110_0100_011_10100_11_000110_111_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
+ test_invalid(&0b1110_0100_111_10100_11_000110_111_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
+
+ test_display(&0b1110_0101_000_10100_11_000110_000_10110u32.to_le_bytes(), "{ R23:22 = mpy(R20, R6) }");
+ test_display(&0b1110_0101_000_10100_11_000110_001_10110u32.to_le_bytes(), "{ R23:22 = cmpyi(R20, R6) }");
+ test_display(&0b1110_0101_000_10100_11_000110_010_10110u32.to_le_bytes(), "{ R23:22 = cmpyr(R20, R6) }");
+ test_invalid(&0b1110_0101_000_10100_11_000110_011_10110u32.to_le_bytes(), DecodeError::InvalidOpcode);
+ test_display(&0b1110_0101_010_10100_11_000110_000_10110u32.to_le_bytes(), "{ R23:22 = mpyu(R20, R6) }");
+ test_display(&0b1110_0101_010_10100_11_000110_001_10110u32.to_le_bytes(), "{ R23:22 = vmpybsu(R20, R6) }");
+ test_display(&0b1110_0101_010_10100_11_000110_111_10110u32.to_le_bytes(), "{ R23:22 = pmpyw(R20, R6) }");
+
+ test_display(&0b1110_0101_100_10100_11_000110_001_10110u32.to_le_bytes(), "{ R23:22 = vmpybu(R20, R6) }");
+ test_display(&0b1110_0101_110_10100_11_000110_111_10110u32.to_le_bytes(), "{ R23:22 = vpmpyh(R20, R6) }");
+
+ test_display(&0b1110_0101_000_10100_11_000110_101_10110u32.to_le_bytes(), "{ R23:22 = vmpyh(R21:20, R7:6):sat }");
+ test_display(&0b1110_0101_000_10100_11_000110_110_10110u32.to_le_bytes(), "{ R23:22 = cmpy(R20, R6):sat }");
+ test_display(&0b1110_0101_000_10100_11_000110_111_10110u32.to_le_bytes(), "{ R23:22 = vmpyhsu(R20, R6):sat }");
+ test_display(&0b1110_0101_010_10100_11_000110_110_10110u32.to_le_bytes(), "{ R23:22 = cmpy(R20, R6*):sat }");
+ test_display(&0b1110_0101_100_10100_11_000110_101_10110u32.to_le_bytes(), "{ R23:22 = vmpyh(R21:20, R7:6):<<1:sat }");
+ test_display(&0b1110_0101_100_10100_11_000110_110_10110u32.to_le_bytes(), "{ R23:22 = cmpy(R20, R6):<<1:sat }");
+ test_display(&0b1110_0101_100_10100_11_000110_111_10110u32.to_le_bytes(), "{ R23:22 = vmpyhsu(R20, R6):<<1:sat }");
+ test_display(&0b1110_0101_110_10100_11_000110_110_10110u32.to_le_bytes(), "{ R23:22 = cmpy(R20, R6*):<<1:sat }");
+}
+
+#[test]
fn inst_1111() {
test_display(&0b1111_0001000_00100_11_0_00011_000_00110u32.to_le_bytes(), "{ R6 = and(R4, R3) }");
test_display(&0b1111_0001001_00100_11_0_00011_000_00110u32.to_le_bytes(), "{ R6 = or(R4, R3) }");