diff --git a/examples/risc_cpu.vhdl.sbd b/examples/risc_cpu.vhdl.sbd index 367bd4c..66e7cad 100644 --- a/examples/risc_cpu.vhdl.sbd +++ b/examples/risc_cpu.vhdl.sbd @@ -1 +1,2642 @@ -{"blocks":{"languageVersion":0,"blocks":[{"type":"process","id":"myj!BNd0mq+A:P@}]5H*","x":-2287,"y":-613,"extraState":{"depCount":1,"all":false},"fields":{"1":{"id":"%+n,:#VbB(@kT^y6[w8@"}},"inputs":{"body":{"block":{"type":"controls_if","id":"%78@n4nD@#9/L1I,bEr%","inputs":{"IF0":{"block":{"type":"logic_rising_edge","id":"M-4j:x@`^D=;o#`GTcVg","fields":{"dep":{"id":"%+n,:#VbB(@kT^y6[w8@"}}}},"DO0":{"block":{"type":"controls_if","id":"S3l:Mm77dwWGUE`v8-Nr","extraState":{"hasElse":true},"inputs":{"IF0":{"block":{"type":"logic_compare","id":"=|_aSm$-+g30x#BV[(d~","fields":{"OP":"EQ"},"inputs":{"A":{"block":{"type":"variables_get","id":"E~9%#sin:}*zWGQtlB,l","fields":{"VAR":{"id":"(w(]5m*(eHVFc7UUhuMp"}}}},"B":{"block":{"type":"value_std_logic","id":"r=jG/snQi.o_oDAIsGV!","fields":{"VALUE":1}}}}}},"DO0":{"block":{"type":"variables_set","id":"7cMHN2IRW,!Q}j14P`GD","fields":{"VAR":{"id":"O_#EE)om~|[Y@z~~[~N*"}},"inputs":{"VALUE":{"block":{"type":"others_to","id":"`fFjA}PqXt~(fn:=3*lr","inputs":{"INPUT":{"block":{"type":"value_std_logic","id":"KJo%-@@aB)}X:9kefld.","fields":{"VALUE":0}}}}}}},"next":{"block":{"type":"variables_set","id":"JLZOcfy}ZAL?sqBYPK-1","fields":{"VAR":{"id":"](3wR=IKW)..UPF(ORvo"}},"inputs":{"VALUE":{"block":{"type":"others_to","id":"w:bur^+!Y-VdRw/=uWb$","inputs":{"INPUT":{"block":{"type":"others_to","id":")7A3go9ztduc`+Uje2`y","inputs":{"INPUT":{"block":{"type":"value_std_logic","id":"64~1W=-N]@AA!oNK1LLI","fields":{"VALUE":0}}}}}}}}}},"next":{"block":{"type":"variables_set","id":"Ra9E7].^v=1vF+hbdM8I","fields":{"VAR":{"id":"JUo@%6fA3Ttz*ZOjK@k="}},"inputs":{"VALUE":{"block":{"type":"others_to","id":"I6NKYk,V)}V,+9W-^;aw","inputs":{"INPUT":{"block":{"type":"value_std_logic","id":"-LDxFZ88pJ_LyAZe+by)","fields":{"VALUE":0}}}}}}},"next":{"block":{"type":"variables_set","id":"[v.}#S!nlf~.b:=;wd.d","fields":{"VAR":{"id":",I(O|A@=x]$$Sk=-e*^+"}},"inputs":{"VALUE":{"block":{"type":"value_std_logic","id":"e_M)oY+L;Eo(?*{d4i:7","fields":{"VALUE":0}}}}}}}}}}}},"ELSE":{"block":{"type":"variables_set_index","id":"oT,?w({bL2NxhM#;?[!V","icons":{"comment":{"text":"The assembler will prevent assignments to reg(6). If the assembled\ninstruction code does manage to assign reg(6), it will be overwritten\non the next clock cycle.","pinned":false,"height":80,"width":160}},"fields":{"VAR":{"id":"](3wR=IKW)..UPF(ORvo"}},"inputs":{"INDEX":{"shadow":{"type":"math_number","id":"d61CO1J;qcV7Qo4-*NPX","fields":{"NUM":6}}},"VALUE":{"block":{"type":"variables_get","id":"0YYffjCtKW,N=Pkl7/Xb","fields":{"VAR":{"id":"FfhY}1:7Uh#%uz=D~/h)"}}}}},"next":{"block":{"type":"controls_if","id":":J:!.xrm^SDjN/cHo38[","inputs":{"IF0":{"block":{"type":"logic_compare","id":"c24v,1@~fW+ZR3OY;I$j","fields":{"OP":"EQ"},"inputs":{"A":{"block":{"type":"variables_get","id":"79|9Dzj{Y:ayfvz{yWh?","fields":{"VAR":{"id":";bOiFOzy/{}N8!zBX}.u"}}}},"B":{"block":{"type":"value_std_logic","id":"#Nh!/M}f3m16HTC1Amv`","fields":{"VALUE":1}}}}}},"DO0":{"block":{"type":"controls_if","id":"2^Y#k2t9z5k9L_}X/Th!","inputs":{"IF0":{"block":{"type":"logic_compare","id":"UP:0mWMUhB|jGyN5UDJl","fields":{"OP":"GT"},"inputs":{"A":{"block":{"type":"variables_get","id":"o2D~j)b+0SUy|3m(X$I4","fields":{"VAR":{"id":"JUo@%6fA3Ttz*ZOjK@k="}}}},"B":{"block":{"type":"math_number","id":"8+U$GHEHqq[F3^JF){yA","fields":{"NUM":0}}}}}},"DO0":{"block":{"type":"variables_set","id":"A+6DtKp4efw~jx_G.kkM","fields":{"VAR":{"id":"JUo@%6fA3Ttz*ZOjK@k="}},"inputs":{"VALUE":{"block":{"type":"math_arithmetic","id":",t?g[kOFMQYWc(~$cbDa","fields":{"OP":"MINUS"},"inputs":{"A":{"shadow":{"type":"math_number","id":"+CM-=XyO_rD_pk#ZgRZh","fields":{"NUM":1}},"block":{"type":"variables_get","id":"fh?8+0rlh5EMnUfG)ty,","fields":{"VAR":{"id":"JUo@%6fA3Ttz*ZOjK@k="}}}},"B":{"shadow":{"type":"math_number","id":",}+F,sq)uuFo?}I=PA5n","fields":{"NUM":1}}}}}}}}}}}}},"next":{"block":{"type":"controls_if","id":"zx/$#}^(i~m`13n8l#ke","icons":{"comment":{"text":"wi is all zeros","pinned":true,"height":80,"width":160}},"inputs":{"IF0":{"block":{"type":"logic_operation_vector","id":"O0j[2O^k{1solIdc*Yxe","fields":{"OPERATION":"nor"},"inputs":{"LIST":{"block":{"type":"variables_get","id":"I*aoD/D;6S,_-6$WBd8R","fields":{"VAR":{"id":"JUo@%6fA3Ttz*ZOjK@k="}}}}}}},"DO0":{"block":{"type":"controls_if","id":"LulA#Phd72hfvcMNm(?h","extraState":{"hasElse":true},"inputs":{"IF0":{"block":{"type":"logic_compare","id":"6uS!Ufx;UW%e(ZX.n-(U","fields":{"OP":"EQ"},"inputs":{"A":{"block":{"type":"variables_get","id":"f?Vr[q/0%TDOI~}eVA3*","fields":{"VAR":{"id":",I(O|A@=x]$$Sk=-e*^+"}}}},"B":{"block":{"type":"value_std_logic","id":"@*4K-$h|KFdP];xJajsI","fields":{"VALUE":1}}}}}},"DO0":{"block":{"type":"math_change","id":"KIoT5ze#@-A-_FB,#UJX","fields":{"VAR":{"id":"O_#EE)om~|[Y@z~~[~N*"}},"inputs":{"DELTA":{"block":{"type":"math_number","id":"qXVqL?=@1u(Oe!rw,1iP","fields":{"NUM":2}}}},"next":{"block":{"type":"variables_set","id":"BaJ^TpRD|Q%ARe%?V)Wr","fields":{"VAR":{"id":",I(O|A@=x]$$Sk=-e*^+"}},"inputs":{"VALUE":{"block":{"type":"value_std_logic","id":"5EMUT[h2=Lt/Q:](!z4#","fields":{"VALUE":0}}}}}}}},"ELSE":{"block":{"type":"math_change","id":"JRMA]!0Alg.UEPI3GFz_","fields":{"VAR":{"id":"O_#EE)om~|[Y@z~~[~N*"}},"inputs":{"DELTA":{"block":{"type":"math_number","id":"Ti*I2*%]7D*-kS,2GUXF","fields":{"NUM":1}}}}}}},"next":{"block":{"type":"controls_case","id":"436Eb8WXnTJ4K+AJ^Q9I","inputs":{"ON":{"block":{"type":"variables_get","id":"I#xQ~1E$SeO7TEKHJ0r0","fields":{"VAR":{"id":"7;4bU%qx,-QxUuNm5yi*"}}}},"body":{"block":{"type":"controls_when","id":"aQV?rtSG/nY~@d/gsuZP","inputs":{"TEST":{"block":{"type":"value_std_logic_vector","id":"fLi`dS7vF^;7T_OE3aK7","fields":{"VALUE":"0001"}}},"body":{"block":{"type":"variables_set_index","id":"W|U(pt6i..*njrA++IIb","fields":{"VAR":{"id":"](3wR=IKW)..UPF(ORvo"}},"inputs":{"INDEX":{"shadow":{"type":"math_number","id":"1WNHTjPGjCSwvCX+Mo^#","fields":{"NUM":0}},"block":{"type":"variables_get","id":"[mnn?W_uYab(_jgWKH^(","fields":{"VAR":{"id":"3~P9sOCf`PuhZKz+qGPB"}}}},"VALUE":{"block":{"type":"list_range","id":")Rrew+_r.k6RR-jR,OLW","fields":{"FROM":3,"ORDER":"downto","TO":0},"inputs":{"LIST":{"block":{"type":"variables_get","id":"AZ`n.$NW~ZE!0AG}KRp!","fields":{"VAR":{"id":"TI4,U=,SY9HKZhXQs=Wj"}}}}}}}}}}},"next":{"block":{"type":"controls_when","id":"aw|Z4;lRbQ#+vV]unJ-1","inputs":{"TEST":{"block":{"type":"value_std_logic_vector","id":"?-6*,s).qSZ)n*.23?@+","fields":{"VALUE":"0010"}}},"body":{"block":{"type":"variables_set_index","id":"7I#!q,Wn#`sJ6|V`pGDn","fields":{"VAR":{"id":"](3wR=IKW)..UPF(ORvo"}},"inputs":{"INDEX":{"shadow":{"type":"math_number","id":"1WNHTjPGjCSwvCX+Mo^#","fields":{"NUM":0}},"block":{"type":"variables_get","id":"=eRLF+3s(DMvll}/%;a1","fields":{"VAR":{"id":"3~P9sOCf`PuhZKz+qGPB"}}}},"VALUE":{"block":{"type":"list_index","id":"9s}5t_IKQ2,ASvxX`/ku","inputs":{"LIST":{"block":{"type":"variables_get","id":"Uyr@wOWjm,K*hP~r/A@^","fields":{"VAR":{"id":"](3wR=IKW)..UPF(ORvo"}}}},"INDEX":{"shadow":{"type":"math_number","id":"Ide6VrU.B+COvR4[h3Eu","fields":{"NUM":0}},"block":{"type":"variables_get","id":"sHvbfrbcT^^h2FJItPUL","fields":{"VAR":{"id":"dlXrUCa@5Yd3}h8:R9H/"}}}}}}}}}}},"next":{"block":{"type":"controls_when","id":"F#5m|prM/ABoa|hOcOT$","inputs":{"TEST":{"block":{"type":"value_std_logic_vector","id":"PS)[BQS$J5/DeD%J?,P!","fields":{"VALUE":"0011"}}},"body":{"block":{"type":"variables_set_index","id":"_eI7PGT,kiE_|hC]2xPN","fields":{"VAR":{"id":"](3wR=IKW)..UPF(ORvo"}},"inputs":{"INDEX":{"shadow":{"type":"math_number","id":"1WNHTjPGjCSwvCX+Mo^#","fields":{"NUM":0}},"block":{"type":"variables_get","id":"v~(gf}Pfrh2o]uJ2qq@o","fields":{"VAR":{"id":"3~P9sOCf`PuhZKz+qGPB"}}}},"VALUE":{"block":{"type":"logic_operation","id":"#]$7CIRHv-dTSjs*!d7]","fields":{"OPERATION":"and"},"inputs":{"A":{"block":{"type":"list_index","id":"vrBpY4dYZ.Ns8adhXt)L","inputs":{"LIST":{"block":{"type":"variables_get","id":"Xb2QyK#W1kv,(u1Z~j.b","fields":{"VAR":{"id":"](3wR=IKW)..UPF(ORvo"}}}},"INDEX":{"shadow":{"type":"math_number","id":"Ide6VrU.B+COvR4[h3Eu","fields":{"NUM":0}},"block":{"type":"variables_get","id":"`p#lL4`fw2oQ+L=4Of=*","fields":{"VAR":{"id":"dlXrUCa@5Yd3}h8:R9H/"}}}}}}},"B":{"block":{"type":"list_index","id":"bfh@BT2tNJNKj15NpfYO","inputs":{"LIST":{"block":{"type":"variables_get","id":"^r{z7BekQUA7Og?*1oTY","fields":{"VAR":{"id":"](3wR=IKW)..UPF(ORvo"}}}},"INDEX":{"shadow":{"type":"math_number","id":"Ide6VrU.B+COvR4[h3Eu","fields":{"NUM":0}},"block":{"type":"variables_get","id":"FecPf@+`)8ZQa:n;_c}i","fields":{"VAR":{"id":"dlXrUCa@5Yd3}h8:R9H/"}}}}}}}}}}}}}},"next":{"block":{"type":"controls_when","id":"U0uL$`GU|1-mN8Sfa,{8","inputs":{"TEST":{"block":{"type":"value_std_logic_vector","id":"AJm[W)tZ0#OcO)(xk6/g","fields":{"VALUE":"0100"}}},"body":{"block":{"type":"variables_set_index","id":")b}sABI(Kb5.so+.bCO9","fields":{"VAR":{"id":"](3wR=IKW)..UPF(ORvo"}},"inputs":{"INDEX":{"shadow":{"type":"math_number","id":"1WNHTjPGjCSwvCX+Mo^#","fields":{"NUM":0}},"block":{"type":"variables_get","id":"ow1m8a$wMn:YfIrKDl.b","fields":{"VAR":{"id":"3~P9sOCf`PuhZKz+qGPB"}}}},"VALUE":{"block":{"type":"logic_operation","id":"g0ti$3P}$8,XNjAqsdmH","fields":{"OPERATION":"or"},"inputs":{"A":{"block":{"type":"list_index","id":"1JO3u!-Dtvqk$X*Df/:a","inputs":{"LIST":{"block":{"type":"variables_get","id":"GlVv`mp+n`,_;$+w]W.b","fields":{"VAR":{"id":"](3wR=IKW)..UPF(ORvo"}}}},"INDEX":{"shadow":{"type":"math_number","id":"Ide6VrU.B+COvR4[h3Eu","fields":{"NUM":0}},"block":{"type":"variables_get","id":"|~-2[h4VyO#xaARLQ`w}","fields":{"VAR":{"id":"dlXrUCa@5Yd3}h8:R9H/"}}}}}}},"B":{"block":{"type":"list_index","id":"Z8N,st}#r8%zC/#]Q*.k","inputs":{"LIST":{"block":{"type":"variables_get","id":"s:K#sJ0YS3l9g!qYPWK7","fields":{"VAR":{"id":"](3wR=IKW)..UPF(ORvo"}}}},"INDEX":{"shadow":{"type":"math_number","id":"Ide6VrU.B+COvR4[h3Eu","fields":{"NUM":0}},"block":{"type":"variables_get","id":"wRErOmuMl0YOyqc.ew~2","fields":{"VAR":{"id":"dlXrUCa@5Yd3}h8:R9H/"}}}}}}}}}}}}}},"next":{"block":{"type":"controls_when","id":"{vF}f(=yWdp1|[|-YT^T","inputs":{"TEST":{"block":{"type":"value_std_logic_vector","id":"Lmgy*K!y+R7anQc4zP]d","fields":{"VALUE":"0101"}}},"body":{"block":{"type":"variables_set_index","id":"}Ca(nTN|d|,P6puYCfc6","fields":{"VAR":{"id":"](3wR=IKW)..UPF(ORvo"}},"inputs":{"INDEX":{"shadow":{"type":"math_number","id":"1WNHTjPGjCSwvCX+Mo^#","fields":{"NUM":0}},"block":{"type":"variables_get","id":"Jh3azem0Vw!Y];W^vsz+","fields":{"VAR":{"id":"3~P9sOCf`PuhZKz+qGPB"}}}},"VALUE":{"block":{"type":"logic_not","id":",.D|{MOOB^8|-$%:!Lo|","inputs":{"INPUT":{"block":{"type":"list_index","id":"d-FZLze:;#.2O@{0ch^[","inputs":{"LIST":{"block":{"type":"variables_get","id":"ham10}*jnk!Qahpf{+L~","fields":{"VAR":{"id":"](3wR=IKW)..UPF(ORvo"}}}},"INDEX":{"shadow":{"type":"math_number","id":"Ide6VrU.B+COvR4[h3Eu","fields":{"NUM":0}},"block":{"type":"variables_get","id":"TH#9Yr2nU{On)q$d+Xda","fields":{"VAR":{"id":"dlXrUCa@5Yd3}h8:R9H/"}}}}}}}}}}}}}},"next":{"block":{"type":"controls_when","id":"n@k3iIIYqQ|r[lMKiwzc","inputs":{"TEST":{"block":{"type":"value_std_logic_vector","id":"?c!N:4n?@c0r`~:/k:!g","fields":{"VALUE":"0110"}}},"body":{"block":{"type":"variables_set_index","id":"lMwFS,z6);43.=#UMFyG","fields":{"VAR":{"id":"](3wR=IKW)..UPF(ORvo"}},"inputs":{"INDEX":{"shadow":{"type":"math_number","id":"1WNHTjPGjCSwvCX+Mo^#","fields":{"NUM":0}},"block":{"type":"variables_get","id":"^J6uf9(nZ$}/Y-aP24aV","fields":{"VAR":{"id":"3~P9sOCf`PuhZKz+qGPB"}}}},"VALUE":{"block":{"type":"math_arithmetic","id":"SK:nx-`j9.]5pjf:}Cdt","fields":{"OP":"ADD"},"inputs":{"A":{"shadow":{"type":"math_number","id":"ot6hE7km*L!@SLzDC`g~","fields":{"NUM":1}},"block":{"type":"list_index","id":"*hV1LX:14,6]fbb;d-m:","inputs":{"LIST":{"block":{"type":"variables_get","id":",5}Oeg[nq+-%?YiKnUJ?","fields":{"VAR":{"id":"](3wR=IKW)..UPF(ORvo"}}}},"INDEX":{"shadow":{"type":"math_number","id":"Ide6VrU.B+COvR4[h3Eu","fields":{"NUM":0}},"block":{"type":"variables_get","id":"HE(K4N-%:H3KBz=FF^PV","fields":{"VAR":{"id":"dlXrUCa@5Yd3}h8:R9H/"}}}}}}},"B":{"shadow":{"type":"math_number","id":"aXD@z6Z=[|++,7PZRk)z","fields":{"NUM":1}},"block":{"type":"list_index","id":"6+;%_S=UZ^wKxO%Uh*3E","inputs":{"LIST":{"block":{"type":"variables_get","id":"yx.qnGWhOvpitzYNDFz`","fields":{"VAR":{"id":"](3wR=IKW)..UPF(ORvo"}}}},"INDEX":{"shadow":{"type":"math_number","id":"Ide6VrU.B+COvR4[h3Eu","fields":{"NUM":0}},"block":{"type":"variables_get","id":"@m~zSHaw}mHjlc%]E49U","fields":{"VAR":{"id":"aA`;[hu}/AdjFE=`.lF2"}}}}}}}}}}}}}},"next":{"block":{"type":"controls_when","id":"qY(J9ZA1=B?y.Kzbp|!W","inputs":{"TEST":{"block":{"type":"value_std_logic_vector","id":"sTGg|BuqDIYnUTJ$*abp","fields":{"VALUE":"0111"}}},"body":{"block":{"type":"variables_set_index","id":"T)M4dG[@cQ6E%`bd}k*T","fields":{"VAR":{"id":"](3wR=IKW)..UPF(ORvo"}},"inputs":{"INDEX":{"shadow":{"type":"math_number","id":"1WNHTjPGjCSwvCX+Mo^#","fields":{"NUM":0}},"block":{"type":"variables_get","id":"10^5;s!AX:~=$_g6@kbU","fields":{"VAR":{"id":"3~P9sOCf`PuhZKz+qGPB"}}}},"VALUE":{"block":{"type":"math_arithmetic","id":"bIFd1;#@nBj$*_J4};g}","fields":{"OP":"MINUS"},"inputs":{"A":{"shadow":{"type":"math_number","id":"ot6hE7km*L!@SLzDC`g~","fields":{"NUM":1}},"block":{"type":"list_index","id":"TP%Fu3P2HZii?cmTHFqK","inputs":{"LIST":{"block":{"type":"variables_get","id":"H}L8*;$gAOaxleK#VNGH","fields":{"VAR":{"id":"](3wR=IKW)..UPF(ORvo"}}}},"INDEX":{"shadow":{"type":"math_number","id":"Ide6VrU.B+COvR4[h3Eu","fields":{"NUM":0}},"block":{"type":"variables_get","id":"xL[ia7Q:K5aBOFA6V$}4","fields":{"VAR":{"id":"dlXrUCa@5Yd3}h8:R9H/"}}}}}}},"B":{"shadow":{"type":"math_number","id":"aXD@z6Z=[|++,7PZRk)z","fields":{"NUM":1}},"block":{"type":"list_index","id":"gUi3ck^n5#?hFXeL7J70","inputs":{"LIST":{"block":{"type":"variables_get","id":"3_.${lzB2xkh/;VI726s","fields":{"VAR":{"id":"](3wR=IKW)..UPF(ORvo"}}}},"INDEX":{"shadow":{"type":"math_number","id":"Ide6VrU.B+COvR4[h3Eu","fields":{"NUM":0}},"block":{"type":"variables_get","id":"5Nwi{zsEy_0qV5k/d52/","fields":{"VAR":{"id":"aA`;[hu}/AdjFE=`.lF2"}}}}}}}}}}}}}},"next":{"block":{"type":"controls_when","id":"l{uxsACWDv*;fKn!hy;c","inputs":{"TEST":{"block":{"type":"value_std_logic_vector","id":"4C+UtAGdfW=)v1Ow6i|2","fields":{"VALUE":"1000"}}},"body":{"block":{"type":"controls_if","id":"*?ZzsFVbtUs%m-bWnKQs","extraState":{"hasElse":true},"inputs":{"IF0":{"block":{"type":"logic_compare","id":"!1Xz=c,1e:ci|lK=c%49","fields":{"OP":"EQ"},"inputs":{"A":{"block":{"type":"list_index","id":"K7=5O8F(J5%Kp6^Cwf9p","inputs":{"LIST":{"block":{"type":"variables_get","id":"{U6*q|WI`3M;gfT=P@f7","fields":{"VAR":{"id":"TI4,U=,SY9HKZhXQs=Wj"}}}},"INDEX":{"shadow":{"type":"math_number","id":";XBT-aM./BG{+HqqR$zL","fields":{"NUM":1}}}}}},"B":{"block":{"type":"value_std_logic","id":"`qi(aL}2Gm-r!nM~+iQ_","fields":{"VALUE":0}}}}}},"DO0":{"block":{"type":"variables_set_index","id":"BQLy(v6_MDPrHT]9%hq~","fields":{"VAR":{"id":"](3wR=IKW)..UPF(ORvo"}},"inputs":{"INDEX":{"shadow":{"type":"math_number","id":"qQE)5qtryHFc9FK@VO-Z","fields":{"NUM":0}},"block":{"type":"variables_get","id":"!_/+Io*feE$vM0idZqgE","fields":{"VAR":{"id":"3~P9sOCf`PuhZKz+qGPB"}}}},"VALUE":{"block":{"type":"list_concat","id":"%q9!rgI0aki3+U!L]!(~","inputs":{"A":{"block":{"type":"list_index","id":"@3Xs|O0{m:9t+:10sdJt","inputs":{"LIST":{"block":{"type":"variables_get","id":"p*0cvM===VYCc7Gh9e@:","fields":{"VAR":{"id":"TI4,U=,SY9HKZhXQs=Wj"}}}},"INDEX":{"shadow":{"type":"math_number","id":"8N/WwE0Z8lvRTn2{{QDV","fields":{"NUM":0}}}}}},"B":{"block":{"type":"list_range","id":"xWR6~Cnb*AKTbHA#X.tt","fields":{"FROM":3,"ORDER":"downto","TO":1},"inputs":{"LIST":{"block":{"type":"list_index","id":"ROTzG?tL@KCgf^g]GEIE","inputs":{"LIST":{"block":{"type":"variables_get","id":"CY^]U$%-K-O2pa=b4{-C","fields":{"VAR":{"id":"](3wR=IKW)..UPF(ORvo"}}}},"INDEX":{"shadow":{"type":"math_number","id":"@n.jCM3eFOYn:-dpl*w,","fields":{"NUM":0}},"block":{"type":"variables_get","id":"}$~Wr;:0#in.Dj,lJq8Z","fields":{"VAR":{"id":"dlXrUCa@5Yd3}h8:R9H/"}}}}}}}}}}}}}}}},"ELSE":{"block":{"type":"variables_set_index","id":"#Y:^S-=xSz;1X)K#P*jQ","fields":{"VAR":{"id":"](3wR=IKW)..UPF(ORvo"}},"inputs":{"INDEX":{"shadow":{"type":"math_number","id":"qQE)5qtryHFc9FK@VO-Z","fields":{"NUM":0}},"block":{"type":"variables_get","id":"I=wm^8VeOn:h?Iw6%]qC","fields":{"VAR":{"id":"3~P9sOCf`PuhZKz+qGPB"}}}},"VALUE":{"block":{"type":"list_concat","id":"s)xGIy|=1?u:`,1aA*jI","inputs":{"A":{"block":{"type":"list_range","id":"xW.}3$P{8KS}kdlNU7[V","fields":{"FROM":2,"ORDER":"downto","TO":0},"inputs":{"LIST":{"block":{"type":"list_index","id":"sywVG,ed}yXHTe9[LbJG","inputs":{"LIST":{"block":{"type":"variables_get","id":"49KV]4AgQiH~sRI!NC;_","fields":{"VAR":{"id":"](3wR=IKW)..UPF(ORvo"}}}},"INDEX":{"shadow":{"type":"math_number","id":"@n.jCM3eFOYn:-dpl*w,","fields":{"NUM":0}},"block":{"type":"variables_get","id":"T^;XCr}fGl3p!pE$fKno","fields":{"VAR":{"id":"dlXrUCa@5Yd3}h8:R9H/"}}}}}}}}}},"B":{"block":{"type":"list_index","id":"CL:UeG}32+P2P*Ug2%1#","inputs":{"LIST":{"block":{"type":"variables_get","id":"x^5[BaKMJ!dm]Bj$-NIJ","fields":{"VAR":{"id":"TI4,U=,SY9HKZhXQs=Wj"}}}},"INDEX":{"shadow":{"type":"math_number","id":"+%JHc8{ItMG-XAA}Btg`","fields":{"NUM":0}}}}}}}}}}}}}}}},"next":{"block":{"type":"controls_when","id":"5S8U`[bAu$O@329*Asbh","inputs":{"TEST":{"block":{"type":"value_std_logic_vector","id":"SE6W70drr+O2Bf.9R7P4","fields":{"VALUE":"1011"}}},"body":{"block":{"type":"controls_if","id":"(tUQx-.s:hWj[DZ=Bm;M","extraState":{"hasElse":true},"inputs":{"IF0":{"block":{"type":"logic_compare","id":"zGxHk*Xy.|-iBNmMm+is","fields":{"OP":"EQ"},"inputs":{"A":{"block":{"type":"list_index","id":"=0AY}8fb6TG20P3xXw??","inputs":{"LIST":{"block":{"type":"variables_get","id":"PvBPN(DsU%*t@TxGJJ-L","fields":{"VAR":{"id":"](3wR=IKW)..UPF(ORvo"}}}},"INDEX":{"shadow":{"type":"math_number","id":"@n.jCM3eFOYn:-dpl*w,","fields":{"NUM":0}},"block":{"type":"variables_get","id":";U6I51YNmH?By=xOo2P#","fields":{"VAR":{"id":"dlXrUCa@5Yd3}h8:R9H/"}}}}}}},"B":{"block":{"type":"list_index","id":"[~p@kCIM:J`0/gw9UZbU","inputs":{"LIST":{"block":{"type":"variables_get","id":"UVEqR^8pL{wuyoiRBR]V","fields":{"VAR":{"id":"](3wR=IKW)..UPF(ORvo"}}}},"INDEX":{"shadow":{"type":"math_number","id":"@n.jCM3eFOYn:-dpl*w,","fields":{"NUM":0}},"block":{"type":"variables_get","id":"?])(=RIh;8h2d#8Wc,RS","fields":{"VAR":{"id":"aA`;[hu}/AdjFE=`.lF2"}}}}}}}}}},"DO0":{"block":{"type":"variables_set","id":"R^%Fk,tm@YELN:dK#UP!","fields":{"VAR":{"id":",I(O|A@=x]$$Sk=-e*^+"}},"inputs":{"VALUE":{"block":{"type":"value_std_logic","id":"SRxNCnx[vV;KIr#wuTNJ","fields":{"VALUE":1}}}}}},"ELSE":{"block":{"type":"math_change","id":"O;)YNKl=h:SVo2dAjORp","fields":{"VAR":{"id":"O_#EE)om~|[Y@z~~[~N*"}},"inputs":{"DELTA":{"block":{"type":"math_number","id":"RySOjPM(^J/X=+b1;%2]","fields":{"NUM":2}}}}}}}}}},"next":{"block":{"type":"controls_when","id":"I$I#~T)U(VaQFnCTmBw=","inputs":{"TEST":{"block":{"type":"value_std_logic_vector","id":"(^O~PmP?:!q`{X.i`G#8","fields":{"VALUE":"1100"}}},"body":{"block":{"type":"controls_if","id":"Z;[~E.r_@^L=*3!5N|4r","extraState":{"hasElse":true},"inputs":{"IF0":{"block":{"type":"logic_compare","id":"0uMVP$^x],CwZ/BbEzn$","fields":{"OP":"GT"},"inputs":{"A":{"block":{"type":"list_index","id":"t,o#oMTPhm^9,aQ8fPg3","inputs":{"LIST":{"block":{"type":"variables_get","id":"sb/G]B.c-Y9dT_JK.9)V","fields":{"VAR":{"id":"](3wR=IKW)..UPF(ORvo"}}}},"INDEX":{"shadow":{"type":"math_number","id":"@n.jCM3eFOYn:-dpl*w,","fields":{"NUM":0}},"block":{"type":"variables_get","id":"E9)Rg1B]cmM9MHVFO.?1","fields":{"VAR":{"id":"dlXrUCa@5Yd3}h8:R9H/"}}}}}}},"B":{"block":{"type":"list_index","id":"a`1$xMBz!p75:mBVAz/s","inputs":{"LIST":{"block":{"type":"variables_get","id":",KsR8J)f[`WV!=}?sNj5","fields":{"VAR":{"id":"](3wR=IKW)..UPF(ORvo"}}}},"INDEX":{"shadow":{"type":"math_number","id":"@n.jCM3eFOYn:-dpl*w,","fields":{"NUM":0}},"block":{"type":"variables_get","id":"eF3*T93PJI2e,uLzQJ|N","fields":{"VAR":{"id":"aA`;[hu}/AdjFE=`.lF2"}}}}}}}}}},"DO0":{"block":{"type":"variables_set","id":"e!kLbbGH3*I%fQy4`/Xs","fields":{"VAR":{"id":",I(O|A@=x]$$Sk=-e*^+"}},"inputs":{"VALUE":{"block":{"type":"value_std_logic","id":"Unc29..kr{5H@5n/=,O`","fields":{"VALUE":1}}}}}},"ELSE":{"block":{"type":"math_change","id":":FOWwaC;s9!Xlxe=0rnq","fields":{"VAR":{"id":"O_#EE)om~|[Y@z~~[~N*"}},"inputs":{"DELTA":{"block":{"type":"math_number","id":"!,ri`{pam,KjTHd)3SF6","fields":{"NUM":2}}}}}}}}}},"next":{"block":{"type":"controls_when","id":"c|KWgNGZPpmg3`Adshwo","inputs":{"TEST":{"block":{"type":"value_std_logic_vector","id":"pjHl5-)n`W]r*b]Z=wg=","fields":{"VALUE":"1101"}}},"body":{"block":{"type":"controls_if","id":"=H6g,-h6I)x]3T0J}ixz","extraState":{"hasElse":true},"inputs":{"IF0":{"block":{"type":"logic_compare","id":"ijb6+xta};qf26XAj_aD","fields":{"OP":"GTE"},"inputs":{"A":{"block":{"type":"list_index","id":"bSJC-!mn2YaO|LOZ_%Rc","inputs":{"LIST":{"block":{"type":"variables_get","id":"6eM-ARWxf}6xWC}0weH,","fields":{"VAR":{"id":"](3wR=IKW)..UPF(ORvo"}}}},"INDEX":{"shadow":{"type":"math_number","id":"@n.jCM3eFOYn:-dpl*w,","fields":{"NUM":0}},"block":{"type":"variables_get","id":"A[MoEghhY_HF7s4;roGU","fields":{"VAR":{"id":"dlXrUCa@5Yd3}h8:R9H/"}}}}}}},"B":{"block":{"type":"list_index","id":"I/7t,!p$?@k.KI^VR,OB","inputs":{"LIST":{"block":{"type":"variables_get","id":"Fe+jrFZ[*)J{)Y=mb2sK","fields":{"VAR":{"id":"](3wR=IKW)..UPF(ORvo"}}}},"INDEX":{"shadow":{"type":"math_number","id":"@n.jCM3eFOYn:-dpl*w,","fields":{"NUM":0}},"block":{"type":"variables_get","id":"6@}S]ymkEY$@t[SdL.[$","fields":{"VAR":{"id":"aA`;[hu}/AdjFE=`.lF2"}}}}}}}}}},"DO0":{"block":{"type":"variables_set","id":"79$cGsJ)rxp?d[}MUEDF","fields":{"VAR":{"id":",I(O|A@=x]$$Sk=-e*^+"}},"inputs":{"VALUE":{"block":{"type":"value_std_logic","id":"L}PTgZAw8T7;-et)1lH1","fields":{"VALUE":1}}}}}},"ELSE":{"block":{"type":"math_change","id":"+j+|kJ9$uRmG_MsM]fmJ","fields":{"VAR":{"id":"O_#EE)om~|[Y@z~~[~N*"}},"inputs":{"DELTA":{"block":{"type":"math_number","id":"V5C6z-0}Q+aJvPhwsL9T","fields":{"NUM":2}}}}}}}}}},"next":{"block":{"type":"controls_when","id":"y`sF@bMs2Qb9OkTmo{-4","inputs":{"TEST":{"block":{"type":"value_std_logic_vector","id":"`5c(YzUk=pJ3i4,$wpZQ","fields":{"VALUE":"1110"}}},"body":{"block":{"type":"variables_set","id":"{!~EAu;9Suq1svy[V37s","fields":{"VAR":{"id":"JUo@%6fA3Ttz*ZOjK@k="}},"inputs":{"VALUE":{"block":{"type":"ieee.numeric_std.unsigned","id":"o`.kdj#p!SR*/Ht[,eKV","inputs":{"NUM":{"block":{"type":"list_range","id":"%q(qDIW8KgMLp.-9`9w=","fields":{"FROM":8,"ORDER":"downto","TO":0},"inputs":{"LIST":{"block":{"type":"variables_get","id":"]#Pf^gP#6;P:Gk,f))xX","fields":{"VAR":{"id":"TI4,U=,SY9HKZhXQs=Wj"}}}}}}}}}}}}}},"next":{"block":{"type":"controls_when","id":"UL~ce88$3BzE*P(JV1vk","inputs":{"TEST":{"block":{"type":"value_std_logic_vector","id":"A;acYa6pvYU).p4$6#7U","fields":{"VALUE":"1111"}}},"body":{"block":{"type":"variables_set","id":"oMpHUbkOnjREm.I%%{Ni","fields":{"VAR":{"id":"O_#EE)om~|[Y@z~~[~N*"}},"inputs":{"VALUE":{"block":{"type":"list_range","id":"8eg~@SpKE*,uWUgG(!F7","fields":{"FROM":8,"ORDER":"downto","TO":0},"inputs":{"LIST":{"block":{"type":"variables_get","id":"8u/j-=evq7N3oA{b1V4H","fields":{"VAR":{"id":"TI4,U=,SY9HKZhXQs=Wj"}}}}}}}},"next":{"block":{"type":"variables_set","id":"k!F@ASO)%ofy}dK;U$9T","fields":{"VAR":{"id":",I(O|A@=x]$$Sk=-e*^+"}},"inputs":{"VALUE":{"block":{"type":"value_std_logic","id":"hq=WR.!h,O[J%|tejI9p","fields":{"VALUE":0}}}}}}}}},"next":{"block":{"type":"controls_when","id":"b#5OdP*=ZcB]GT]EDL:Z","inputs":{"TEST":{"block":{"type":"logic_others","id":"MvCP^~,qm5]sw1v|J`+`"}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}},{"type":"process_direct_set","id":"Wx[kE9B@oPQaJls-xl)G","x":-2288,"y":-1187,"fields":{"VAR":{"id":"(OZR3:mGI_kT5)!,?cg*"}},"inputs":{"VALUE":{"block":{"type":"list_index","id":"JY/v(waMZp(@B}IyUfL]","inputs":{"LIST":{"block":{"type":"variables_get","id":"`2Z_I:e0-6tt3sSofoC6","fields":{"VAR":{"id":"](3wR=IKW)..UPF(ORvo"}}}},"INDEX":{"shadow":{"type":"math_number","id":"`u4)^`C!4iYQfT-iU/ht","fields":{"NUM":7}}}}}}}},{"type":"process_direct_set","id":"vmu!Qk;kfChyWJOeCxC@","x":-2287,"y":-1111,"fields":{"VAR":{"id":"TI4,U=,SY9HKZhXQs=Wj"}},"inputs":{"VALUE":{"block":{"type":"list_index","id":"py-os0zC8|qj!juS0kuc","inputs":{"LIST":{"block":{"type":"constant","id":"yR8-xF4sEUi+K-LI)t:v","fields":{"NAME":"code"}}},"INDEX":{"shadow":{"type":"math_number","id":"yA._~)I?08I(eTnmM(GU","fields":{"NUM":0}},"block":{"type":"ieee.numeric_std.to_integer","id":":eCLv`lnx49EjIgS(qta","inputs":{"NUM":{"block":{"type":"ieee.numeric_std.unsigned","id":"G.bL9cxw0ip)d:ufN7,S","inputs":{"NUM":{"block":{"type":"variables_get","id":"s]WYRdP.(8GTa?n=2d.o","fields":{"VAR":{"id":"O_#EE)om~|[Y@z~~[~N*"}}}}}}}}}}}}}}},{"type":"process_direct_set","id":"eUaL5q$0,l/tV(6_+K,?","x":-2288,"y":-1012,"fields":{"VAR":{"id":"7;4bU%qx,-QxUuNm5yi*"}},"inputs":{"VALUE":{"block":{"type":"list_range","id":"jm..@f#/r8LSuY;!@Z5@","fields":{"FROM":12,"ORDER":"downto","TO":9},"inputs":{"LIST":{"block":{"type":"variables_get","id":"(7]Z+QI{n3*x*``EQrU5","fields":{"VAR":{"id":"TI4,U=,SY9HKZhXQs=Wj"}}}}}}}}},{"type":"process_direct_set","id":"e%Dg9X!X_D|5nK$u9#Ae","x":-2286,"y":-937,"fields":{"VAR":{"id":"3~P9sOCf`PuhZKz+qGPB"}},"inputs":{"VALUE":{"block":{"type":"ieee.numeric_std.to_integer","id":"29_oSIxR?eX4)8{=5i;K","inputs":{"NUM":{"block":{"type":"ieee.numeric_std.unsigned","id":"Kr^:U}|uJE#,O{.j}:q:","inputs":{"NUM":{"block":{"type":"list_range","id":"|*PTztUm7YX:R@eH*y7r","fields":{"FROM":8,"ORDER":"downto","TO":6},"inputs":{"LIST":{"block":{"type":"variables_get","id":"Txh9JF{%nt}xR+*{XSpo","fields":{"VAR":{"id":"TI4,U=,SY9HKZhXQs=Wj"}}}}}}}}}}}}}}},{"type":"process_direct_set","id":"wXoL*:nk%:TWFSZY+A+]","x":-2286,"y":-837,"fields":{"VAR":{"id":"dlXrUCa@5Yd3}h8:R9H/"}},"inputs":{"VALUE":{"block":{"type":"ieee.numeric_std.to_integer","id":"u[C@W;[`?bRCV!trxm1Q","inputs":{"NUM":{"block":{"type":"ieee.numeric_std.unsigned","id":"k3W-D!|`So25X,x=N=4H","inputs":{"NUM":{"block":{"type":"list_range","id":"gt/wX%kU1wzN`d]?xxzk","fields":{"FROM":5,"ORDER":"downto","TO":3},"inputs":{"LIST":{"block":{"type":"variables_get","id":"@P5@^K.LW;1Y$W=FKeT*","fields":{"VAR":{"id":"TI4,U=,SY9HKZhXQs=Wj"}}}}}}}}}}}}}}},{"type":"process_direct_set","id":"BC[wJX,jj0=88#)Hdw*y","x":-2288,"y":-737,"fields":{"VAR":{"id":"aA`;[hu}/AdjFE=`.lF2"}},"inputs":{"VALUE":{"block":{"type":"ieee.numeric_std.to_integer","id":"tY=7hVc`?8{yb*Pm(1S{","inputs":{"NUM":{"block":{"type":"ieee.numeric_std.unsigned","id":"AbNwznnF1(rw+OUvVdTx","inputs":{"NUM":{"block":{"type":"list_range","id":"EqqHN6E%{wGMp656(phy","fields":{"FROM":2,"ORDER":"downto","TO":0},"inputs":{"LIST":{"block":{"type":"variables_get","id":"WfC5i/ZiX~p8YWqbkZC{","fields":{"VAR":{"id":"TI4,U=,SY9HKZhXQs=Wj"}}}}}}}}}}}}}}}]},"variables":[{"name":"clk","id":"%+n,:#VbB(@kT^y6[w8@"},{"name":"reset","id":"(w(]5m*(eHVFc7UUhuMp"},{"name":"incr","id":";bOiFOzy/{}N8!zBX}.u"},{"name":"buttons","id":"FfhY}1:7Uh#%uz=D~/h)"},{"name":"leds","id":"(OZR3:mGI_kT5)!,?cg*"},{"name":"pc","id":"O_#EE)om~|[Y@z~~[~N*"},{"name":"pc_value","id":"TI4,U=,SY9HKZhXQs=Wj"},{"name":"pc_op","id":"7;4bU%qx,-QxUuNm5yi*"},{"name":"pc_dest","id":"3~P9sOCf`PuhZKz+qGPB"},{"name":"pc_src1","id":"dlXrUCa@5Yd3}h8:R9H/"},{"name":"pc_src2","id":"aA`;[hu}/AdjFE=`.lF2"},{"name":"wi","id":"JUo@%6fA3Ttz*ZOjK@k="},{"name":"eif","id":",I(O|A@=x]$$Sk=-e*^+"},{"name":"reg","id":"](3wR=IKW)..UPF(ORvo"}]} \ No newline at end of file +{ + "blocks": { + "languageVersion": 0, + "blocks": [ + { + "type": "process", + "id": "myj!BNd0mq+A:P@}]5H*", + "x": -2287, + "y": -613, + "extraState": { + "depCount": 1, + "all": false + }, + "fields": { + "1": { + "name": "clk" + } + }, + "inputs": { + "body": { + "block": { + "type": "controls_if", + "id": "%78@n4nD@#9/L1I,bEr%", + "inputs": { + "IF0": { + "block": { + "type": "logic_rising_edge", + "id": "M-4j:x@`^D=;o#`GTcVg", + "fields": { + "dep": { + "name": "clk" + } + } + } + }, + "DO0": { + "block": { + "type": "controls_if", + "id": "S3l:Mm77dwWGUE`v8-Nr", + "extraState": { + "hasElse": true + }, + "inputs": { + "IF0": { + "block": { + "type": "logic_compare", + "id": "=|_aSm$-+g30x#BV[(d~", + "fields": { + "OP": "EQ" + }, + "inputs": { + "A": { + "block": { + "type": "variables_get", + "id": "E~9%#sin:}*zWGQtlB,l", + "fields": { + "VAR": { + "name": "reset" + } + } + } + }, + "B": { + "block": { + "type": "value_std_logic", + "id": "r=jG/snQi.o_oDAIsGV!", + "fields": { + "VALUE": 1 + } + } + } + } + } + }, + "DO0": { + "block": { + "type": "variables_set", + "id": "7cMHN2IRW,!Q}j14P`GD", + "fields": { + "VAR": { + "name": "pc" + } + }, + "inputs": { + "VALUE": { + "block": { + "type": "others_to", + "id": "`fFjA}PqXt~(fn:=3*lr", + "inputs": { + "INPUT": { + "block": { + "type": "value_std_logic", + "id": "KJo%-@@aB)}X:9kefld.", + "fields": { + "VALUE": 0 + } + } + } + } + } + } + }, + "next": { + "block": { + "type": "variables_set", + "id": "JLZOcfy}ZAL?sqBYPK-1", + "fields": { + "VAR": { + "name": "reg" + } + }, + "inputs": { + "VALUE": { + "block": { + "type": "others_to", + "id": "w:bur^+!Y-VdRw/=uWb$", + "inputs": { + "INPUT": { + "block": { + "type": "others_to", + "id": ")7A3go9ztduc`+Uje2`y", + "inputs": { + "INPUT": { + "block": { + "type": "value_std_logic", + "id": "64~1W=-N]@AA!oNK1LLI", + "fields": { + "VALUE": 0 + } + } + } + } + } + } + } + } + } + }, + "next": { + "block": { + "type": "variables_set", + "id": "Ra9E7].^v=1vF+hbdM8I", + "fields": { + "VAR": { + "name": "wi" + } + }, + "inputs": { + "VALUE": { + "block": { + "type": "others_to", + "id": "I6NKYk,V)}V,+9W-^;aw", + "inputs": { + "INPUT": { + "block": { + "type": "value_std_logic", + "id": "-LDxFZ88pJ_LyAZe+by)", + "fields": { + "VALUE": 0 + } + } + } + } + } + } + }, + "next": { + "block": { + "type": "variables_set", + "id": "[v.}#S!nlf~.b:=;wd.d", + "fields": { + "VAR": { + "name": "eif" + } + }, + "inputs": { + "VALUE": { + "block": { + "type": "value_std_logic", + "id": "e_M)oY+L;Eo(?*{d4i:7", + "fields": { + "VALUE": 0 + } + } + } + } + } + } + } + } + } + } + } + }, + "ELSE": { + "block": { + "type": "variables_set_index", + "id": "oT,?w({bL2NxhM#;?[!V", + "icons": { + "comment": { + "text": "The assembler will prevent assignments to reg(6). If the assembled\ninstruction code does manage to assign reg(6), it will be overwritten\non the next clock cycle.", + "pinned": false, + "height": 80, + "width": 160 + } + }, + "fields": { + "VAR": { + "name": "reg" + } + }, + "inputs": { + "INDEX": { + "shadow": { + "type": "math_number", + "id": "d61CO1J;qcV7Qo4-*NPX", + "fields": { + "NUM": 6 + } + } + }, + "VALUE": { + "block": { + "type": "variables_get", + "id": "0YYffjCtKW,N=Pkl7/Xb", + "fields": { + "VAR": { + "name": "buttons" + } + } + } + } + }, + "next": { + "block": { + "type": "controls_if", + "id": ":J:!.xrm^SDjN/cHo38[", + "inputs": { + "IF0": { + "block": { + "type": "logic_compare", + "id": "c24v,1@~fW+ZR3OY;I$j", + "fields": { + "OP": "EQ" + }, + "inputs": { + "A": { + "block": { + "type": "variables_get", + "id": "79|9Dzj{Y:ayfvz{yWh?", + "fields": { + "VAR": { + "name": "incr" + } + } + } + }, + "B": { + "block": { + "type": "value_std_logic", + "id": "#Nh!/M}f3m16HTC1Amv`", + "fields": { + "VALUE": 1 + } + } + } + } + } + }, + "DO0": { + "block": { + "type": "controls_if", + "id": "2^Y#k2t9z5k9L_}X/Th!", + "inputs": { + "IF0": { + "block": { + "type": "logic_compare", + "id": "UP:0mWMUhB|jGyN5UDJl", + "fields": { + "OP": "GT" + }, + "inputs": { + "A": { + "block": { + "type": "variables_get", + "id": "o2D~j)b+0SUy|3m(X$I4", + "fields": { + "VAR": { + "name": "wi" + } + } + } + }, + "B": { + "block": { + "type": "math_number", + "id": "8+U$GHEHqq[F3^JF){yA", + "fields": { + "NUM": 0 + } + } + } + } + } + }, + "DO0": { + "block": { + "type": "variables_set", + "id": "A+6DtKp4efw~jx_G.kkM", + "fields": { + "VAR": { + "name": "wi" + } + }, + "inputs": { + "VALUE": { + "block": { + "type": "math_arithmetic", + "id": ",t?g[kOFMQYWc(~$cbDa", + "fields": { + "OP": "MINUS" + }, + "inputs": { + "A": { + "shadow": { + "type": "math_number", + "id": "+CM-=XyO_rD_pk#ZgRZh", + "fields": { + "NUM": 1 + } + }, + "block": { + "type": "variables_get", + "id": "fh?8+0rlh5EMnUfG)ty,", + "fields": { + "VAR": { + "name": "wi" + } + } + } + }, + "B": { + "shadow": { + "type": "math_number", + "id": ",}+F,sq)uuFo?}I=PA5n", + "fields": { + "NUM": 1 + } + } + } + } + } + } + } + } + } + } + } + } + }, + "next": { + "block": { + "type": "controls_if", + "id": "zx/$#}^(i~m`13n8l#ke", + "icons": { + "comment": { + "text": "wi is all zeros", + "pinned": true, + "height": 80, + "width": 160 + } + }, + "inputs": { + "IF0": { + "block": { + "type": "logic_operation_vector", + "id": "O0j[2O^k{1solIdc*Yxe", + "fields": { + "OPERATION": "nor" + }, + "inputs": { + "LIST": { + "block": { + "type": "variables_get", + "id": "I*aoD/D;6S,_-6$WBd8R", + "fields": { + "VAR": { + "name": "wi" + } + } + } + } + } + } + }, + "DO0": { + "block": { + "type": "controls_if", + "id": "LulA#Phd72hfvcMNm(?h", + "extraState": { + "hasElse": true + }, + "inputs": { + "IF0": { + "block": { + "type": "logic_compare", + "id": "6uS!Ufx;UW%e(ZX.n-(U", + "fields": { + "OP": "EQ" + }, + "inputs": { + "A": { + "block": { + "type": "variables_get", + "id": "f?Vr[q/0%TDOI~}eVA3*", + "fields": { + "VAR": { + "name": "eif" + } + } + } + }, + "B": { + "block": { + "type": "value_std_logic", + "id": "@*4K-$h|KFdP];xJajsI", + "fields": { + "VALUE": 1 + } + } + } + } + } + }, + "DO0": { + "block": { + "type": "math_change", + "id": "KIoT5ze#@-A-_FB,#UJX", + "fields": { + "VAR": { + "name": "pc" + } + }, + "inputs": { + "DELTA": { + "block": { + "type": "math_number", + "id": "qXVqL?=@1u(Oe!rw,1iP", + "fields": { + "NUM": 2 + } + } + } + }, + "next": { + "block": { + "type": "variables_set", + "id": "BaJ^TpRD|Q%ARe%?V)Wr", + "fields": { + "VAR": { + "name": "eif" + } + }, + "inputs": { + "VALUE": { + "block": { + "type": "value_std_logic", + "id": "5EMUT[h2=Lt/Q:](!z4#", + "fields": { + "VALUE": 0 + } + } + } + } + } + } + } + }, + "ELSE": { + "block": { + "type": "math_change", + "id": "JRMA]!0Alg.UEPI3GFz_", + "fields": { + "VAR": { + "name": "pc" + } + }, + "inputs": { + "DELTA": { + "block": { + "type": "math_number", + "id": "Ti*I2*%]7D*-kS,2GUXF", + "fields": { + "NUM": 1 + } + } + } + } + } + } + }, + "next": { + "block": { + "type": "controls_case", + "id": "436Eb8WXnTJ4K+AJ^Q9I", + "inputs": { + "ON": { + "block": { + "type": "variables_get", + "id": "I#xQ~1E$SeO7TEKHJ0r0", + "fields": { + "VAR": { + "name": "pc_op" + } + } + } + }, + "body": { + "block": { + "type": "controls_when", + "id": "aQV?rtSG/nY~@d/gsuZP", + "inputs": { + "TEST": { + "block": { + "type": "value_std_logic_vector", + "id": "fLi`dS7vF^;7T_OE3aK7", + "fields": { + "VALUE": "0001" + } + } + }, + "body": { + "block": { + "type": "variables_set_index", + "id": "W|U(pt6i..*njrA++IIb", + "fields": { + "VAR": { + "name": "reg" + } + }, + "inputs": { + "INDEX": { + "shadow": { + "type": "math_number", + "id": "1WNHTjPGjCSwvCX+Mo^#", + "fields": { + "NUM": 0 + } + }, + "block": { + "type": "variables_get", + "id": "[mnn?W_uYab(_jgWKH^(", + "fields": { + "VAR": { + "name": "pc_dest" + } + } + } + }, + "VALUE": { + "block": { + "type": "list_range", + "id": ")Rrew+_r.k6RR-jR,OLW", + "fields": { + "FROM": 3, + "ORDER": "downto", + "TO": 0 + }, + "inputs": { + "LIST": { + "block": { + "type": "variables_get", + "id": "AZ`n.$NW~ZE!0AG}KRp!", + "fields": { + "VAR": { + "name": "pc_value" + } + } + } + } + } + } + } + } + } + } + }, + "next": { + "block": { + "type": "controls_when", + "id": "aw|Z4;lRbQ#+vV]unJ-1", + "inputs": { + "TEST": { + "block": { + "type": "value_std_logic_vector", + "id": "?-6*,s).qSZ)n*.23?@+", + "fields": { + "VALUE": "0010" + } + } + }, + "body": { + "block": { + "type": "variables_set_index", + "id": "7I#!q,Wn#`sJ6|V`pGDn", + "fields": { + "VAR": { + "name": "reg" + } + }, + "inputs": { + "INDEX": { + "shadow": { + "type": "math_number", + "id": "1WNHTjPGjCSwvCX+Mo^#", + "fields": { + "NUM": 0 + } + }, + "block": { + "type": "variables_get", + "id": "=eRLF+3s(DMvll}/%;a1", + "fields": { + "VAR": { + "name": "pc_dest" + } + } + } + }, + "VALUE": { + "block": { + "type": "list_index", + "id": "9s}5t_IKQ2,ASvxX`/ku", + "inputs": { + "LIST": { + "block": { + "type": "variables_get", + "id": "Uyr@wOWjm,K*hP~r/A@^", + "fields": { + "VAR": { + "name": "reg" + } + } + } + }, + "INDEX": { + "shadow": { + "type": "math_number", + "id": "Ide6VrU.B+COvR4[h3Eu", + "fields": { + "NUM": 0 + } + }, + "block": { + "type": "variables_get", + "id": "sHvbfrbcT^^h2FJItPUL", + "fields": { + "VAR": { + "name": "pc_src1" + } + } + } + } + } + } + } + } + } + } + }, + "next": { + "block": { + "type": "controls_when", + "id": "F#5m|prM/ABoa|hOcOT$", + "inputs": { + "TEST": { + "block": { + "type": "value_std_logic_vector", + "id": "PS)[BQS$J5/DeD%J?,P!", + "fields": { + "VALUE": "0011" + } + } + }, + "body": { + "block": { + "type": "variables_set_index", + "id": "_eI7PGT,kiE_|hC]2xPN", + "fields": { + "VAR": { + "name": "reg" + } + }, + "inputs": { + "INDEX": { + "shadow": { + "type": "math_number", + "id": "1WNHTjPGjCSwvCX+Mo^#", + "fields": { + "NUM": 0 + } + }, + "block": { + "type": "variables_get", + "id": "v~(gf}Pfrh2o]uJ2qq@o", + "fields": { + "VAR": { + "name": "pc_dest" + } + } + } + }, + "VALUE": { + "block": { + "type": "logic_operation", + "id": "#]$7CIRHv-dTSjs*!d7]", + "fields": { + "OPERATION": "and" + }, + "inputs": { + "A": { + "block": { + "type": "list_index", + "id": "vrBpY4dYZ.Ns8adhXt)L", + "inputs": { + "LIST": { + "block": { + "type": "variables_get", + "id": "Xb2QyK#W1kv,(u1Z~j.b", + "fields": { + "VAR": { + "name": "reg" + } + } + } + }, + "INDEX": { + "shadow": { + "type": "math_number", + "id": "Ide6VrU.B+COvR4[h3Eu", + "fields": { + "NUM": 0 + } + }, + "block": { + "type": "variables_get", + "id": "`p#lL4`fw2oQ+L=4Of=*", + "fields": { + "VAR": { + "name": "pc_src1" + } + } + } + } + } + } + }, + "B": { + "block": { + "type": "list_index", + "id": "bfh@BT2tNJNKj15NpfYO", + "inputs": { + "LIST": { + "block": { + "type": "variables_get", + "id": "^r{z7BekQUA7Og?*1oTY", + "fields": { + "VAR": { + "name": "reg" + } + } + } + }, + "INDEX": { + "shadow": { + "type": "math_number", + "id": "Ide6VrU.B+COvR4[h3Eu", + "fields": { + "NUM": 0 + } + }, + "block": { + "type": "variables_get", + "id": "FecPf@+`)8ZQa:n;_c}i", + "fields": { + "VAR": { + "name": "pc_src1" + } + } + } + } + } + } + } + } + } + } + } + } + } + }, + "next": { + "block": { + "type": "controls_when", + "id": "U0uL$`GU|1-mN8Sfa,{8", + "inputs": { + "TEST": { + "block": { + "type": "value_std_logic_vector", + "id": "AJm[W)tZ0#OcO)(xk6/g", + "fields": { + "VALUE": "0100" + } + } + }, + "body": { + "block": { + "type": "variables_set_index", + "id": ")b}sABI(Kb5.so+.bCO9", + "fields": { + "VAR": { + "name": "reg" + } + }, + "inputs": { + "INDEX": { + "shadow": { + "type": "math_number", + "id": "1WNHTjPGjCSwvCX+Mo^#", + "fields": { + "NUM": 0 + } + }, + "block": { + "type": "variables_get", + "id": "ow1m8a$wMn:YfIrKDl.b", + "fields": { + "VAR": { + "name": "pc_dest" + } + } + } + }, + "VALUE": { + "block": { + "type": "logic_operation", + "id": "g0ti$3P}$8,XNjAqsdmH", + "fields": { + "OPERATION": "or" + }, + "inputs": { + "A": { + "block": { + "type": "list_index", + "id": "1JO3u!-Dtvqk$X*Df/:a", + "inputs": { + "LIST": { + "block": { + "type": "variables_get", + "id": "GlVv`mp+n`,_;$+w]W.b", + "fields": { + "VAR": { + "name": "reg" + } + } + } + }, + "INDEX": { + "shadow": { + "type": "math_number", + "id": "Ide6VrU.B+COvR4[h3Eu", + "fields": { + "NUM": 0 + } + }, + "block": { + "type": "variables_get", + "id": "|~-2[h4VyO#xaARLQ`w}", + "fields": { + "VAR": { + "name": "pc_src1" + } + } + } + } + } + } + }, + "B": { + "block": { + "type": "list_index", + "id": "Z8N,st}#r8%zC/#]Q*.k", + "inputs": { + "LIST": { + "block": { + "type": "variables_get", + "id": "s:K#sJ0YS3l9g!qYPWK7", + "fields": { + "VAR": { + "name": "reg" + } + } + } + }, + "INDEX": { + "shadow": { + "type": "math_number", + "id": "Ide6VrU.B+COvR4[h3Eu", + "fields": { + "NUM": 0 + } + }, + "block": { + "type": "variables_get", + "id": "wRErOmuMl0YOyqc.ew~2", + "fields": { + "VAR": { + "name": "pc_src1" + } + } + } + } + } + } + } + } + } + } + } + } + } + }, + "next": { + "block": { + "type": "controls_when", + "id": "{vF}f(=yWdp1|[|-YT^T", + "inputs": { + "TEST": { + "block": { + "type": "value_std_logic_vector", + "id": "Lmgy*K!y+R7anQc4zP]d", + "fields": { + "VALUE": "0101" + } + } + }, + "body": { + "block": { + "type": "variables_set_index", + "id": "}Ca(nTN|d|,P6puYCfc6", + "fields": { + "VAR": { + "name": "reg" + } + }, + "inputs": { + "INDEX": { + "shadow": { + "type": "math_number", + "id": "1WNHTjPGjCSwvCX+Mo^#", + "fields": { + "NUM": 0 + } + }, + "block": { + "type": "variables_get", + "id": "Jh3azem0Vw!Y];W^vsz+", + "fields": { + "VAR": { + "name": "pc_dest" + } + } + } + }, + "VALUE": { + "block": { + "type": "logic_not", + "id": ",.D|{MOOB^8|-$%:!Lo|", + "inputs": { + "INPUT": { + "block": { + "type": "list_index", + "id": "d-FZLze:;#.2O@{0ch^[", + "inputs": { + "LIST": { + "block": { + "type": "variables_get", + "id": "ham10}*jnk!Qahpf{+L~", + "fields": { + "VAR": { + "name": "reg" + } + } + } + }, + "INDEX": { + "shadow": { + "type": "math_number", + "id": "Ide6VrU.B+COvR4[h3Eu", + "fields": { + "NUM": 0 + } + }, + "block": { + "type": "variables_get", + "id": "TH#9Yr2nU{On)q$d+Xda", + "fields": { + "VAR": { + "name": "pc_src1" + } + } + } + } + } + } + } + } + } + } + } + } + } + }, + "next": { + "block": { + "type": "controls_when", + "id": "n@k3iIIYqQ|r[lMKiwzc", + "inputs": { + "TEST": { + "block": { + "type": "value_std_logic_vector", + "id": "?c!N:4n?@c0r`~:/k:!g", + "fields": { + "VALUE": "0110" + } + } + }, + "body": { + "block": { + "type": "variables_set_index", + "id": "lMwFS,z6);43.=#UMFyG", + "fields": { + "VAR": { + "name": "reg" + } + }, + "inputs": { + "INDEX": { + "shadow": { + "type": "math_number", + "id": "1WNHTjPGjCSwvCX+Mo^#", + "fields": { + "NUM": 0 + } + }, + "block": { + "type": "variables_get", + "id": "^J6uf9(nZ$}/Y-aP24aV", + "fields": { + "VAR": { + "name": "pc_dest" + } + } + } + }, + "VALUE": { + "block": { + "type": "math_arithmetic", + "id": "SK:nx-`j9.]5pjf:}Cdt", + "fields": { + "OP": "ADD" + }, + "inputs": { + "A": { + "shadow": { + "type": "math_number", + "id": "ot6hE7km*L!@SLzDC`g~", + "fields": { + "NUM": 1 + } + }, + "block": { + "type": "list_index", + "id": "*hV1LX:14,6]fbb;d-m:", + "inputs": { + "LIST": { + "block": { + "type": "variables_get", + "id": ",5}Oeg[nq+-%?YiKnUJ?", + "fields": { + "VAR": { + "name": "reg" + } + } + } + }, + "INDEX": { + "shadow": { + "type": "math_number", + "id": "Ide6VrU.B+COvR4[h3Eu", + "fields": { + "NUM": 0 + } + }, + "block": { + "type": "variables_get", + "id": "HE(K4N-%:H3KBz=FF^PV", + "fields": { + "VAR": { + "name": "pc_src1" + } + } + } + } + } + } + }, + "B": { + "shadow": { + "type": "math_number", + "id": "aXD@z6Z=[|++,7PZRk)z", + "fields": { + "NUM": 1 + } + }, + "block": { + "type": "list_index", + "id": "6+;%_S=UZ^wKxO%Uh*3E", + "inputs": { + "LIST": { + "block": { + "type": "variables_get", + "id": "yx.qnGWhOvpitzYNDFz`", + "fields": { + "VAR": { + "name": "reg" + } + } + } + }, + "INDEX": { + "shadow": { + "type": "math_number", + "id": "Ide6VrU.B+COvR4[h3Eu", + "fields": { + "NUM": 0 + } + }, + "block": { + "type": "variables_get", + "id": "@m~zSHaw}mHjlc%]E49U", + "fields": { + "VAR": { + "name": "pc_src2" + } + } + } + } + } + } + } + } + } + } + } + } + } + }, + "next": { + "block": { + "type": "controls_when", + "id": "qY(J9ZA1=B?y.Kzbp|!W", + "inputs": { + "TEST": { + "block": { + "type": "value_std_logic_vector", + "id": "sTGg|BuqDIYnUTJ$*abp", + "fields": { + "VALUE": "0111" + } + } + }, + "body": { + "block": { + "type": "variables_set_index", + "id": "T)M4dG[@cQ6E%`bd}k*T", + "fields": { + "VAR": { + "name": "reg" + } + }, + "inputs": { + "INDEX": { + "shadow": { + "type": "math_number", + "id": "1WNHTjPGjCSwvCX+Mo^#", + "fields": { + "NUM": 0 + } + }, + "block": { + "type": "variables_get", + "id": "10^5;s!AX:~=$_g6@kbU", + "fields": { + "VAR": { + "name": "pc_dest" + } + } + } + }, + "VALUE": { + "block": { + "type": "math_arithmetic", + "id": "bIFd1;#@nBj$*_J4};g}", + "fields": { + "OP": "MINUS" + }, + "inputs": { + "A": { + "shadow": { + "type": "math_number", + "id": "ot6hE7km*L!@SLzDC`g~", + "fields": { + "NUM": 1 + } + }, + "block": { + "type": "list_index", + "id": "TP%Fu3P2HZii?cmTHFqK", + "inputs": { + "LIST": { + "block": { + "type": "variables_get", + "id": "H}L8*;$gAOaxleK#VNGH", + "fields": { + "VAR": { + "name": "reg" + } + } + } + }, + "INDEX": { + "shadow": { + "type": "math_number", + "id": "Ide6VrU.B+COvR4[h3Eu", + "fields": { + "NUM": 0 + } + }, + "block": { + "type": "variables_get", + "id": "xL[ia7Q:K5aBOFA6V$}4", + "fields": { + "VAR": { + "name": "pc_src1" + } + } + } + } + } + } + }, + "B": { + "shadow": { + "type": "math_number", + "id": "aXD@z6Z=[|++,7PZRk)z", + "fields": { + "NUM": 1 + } + }, + "block": { + "type": "list_index", + "id": "gUi3ck^n5#?hFXeL7J70", + "inputs": { + "LIST": { + "block": { + "type": "variables_get", + "id": "3_.${lzB2xkh/;VI726s", + "fields": { + "VAR": { + "name": "reg" + } + } + } + }, + "INDEX": { + "shadow": { + "type": "math_number", + "id": "Ide6VrU.B+COvR4[h3Eu", + "fields": { + "NUM": 0 + } + }, + "block": { + "type": "variables_get", + "id": "5Nwi{zsEy_0qV5k/d52/", + "fields": { + "VAR": { + "name": "pc_src2" + } + } + } + } + } + } + } + } + } + } + } + } + } + }, + "next": { + "block": { + "type": "controls_when", + "id": "l{uxsACWDv*;fKn!hy;c", + "inputs": { + "TEST": { + "block": { + "type": "value_std_logic_vector", + "id": "4C+UtAGdfW=)v1Ow6i|2", + "fields": { + "VALUE": "1000" + } + } + }, + "body": { + "block": { + "type": "controls_if", + "id": "*?ZzsFVbtUs%m-bWnKQs", + "extraState": { + "hasElse": true + }, + "inputs": { + "IF0": { + "block": { + "type": "logic_compare", + "id": "!1Xz=c,1e:ci|lK=c%49", + "fields": { + "OP": "EQ" + }, + "inputs": { + "A": { + "block": { + "type": "list_index", + "id": "K7=5O8F(J5%Kp6^Cwf9p", + "inputs": { + "LIST": { + "block": { + "type": "variables_get", + "id": "{U6*q|WI`3M;gfT=P@f7", + "fields": { + "VAR": { + "name": "pc_value" + } + } + } + }, + "INDEX": { + "shadow": { + "type": "math_number", + "id": ";XBT-aM./BG{+HqqR$zL", + "fields": { + "NUM": 1 + } + } + } + } + } + }, + "B": { + "block": { + "type": "value_std_logic", + "id": "`qi(aL}2Gm-r!nM~+iQ_", + "fields": { + "VALUE": 0 + } + } + } + } + } + }, + "DO0": { + "block": { + "type": "variables_set_index", + "id": "BQLy(v6_MDPrHT]9%hq~", + "fields": { + "VAR": { + "name": "reg" + } + }, + "inputs": { + "INDEX": { + "shadow": { + "type": "math_number", + "id": "qQE)5qtryHFc9FK@VO-Z", + "fields": { + "NUM": 0 + } + }, + "block": { + "type": "variables_get", + "id": "!_/+Io*feE$vM0idZqgE", + "fields": { + "VAR": { + "name": "pc_dest" + } + } + } + }, + "VALUE": { + "block": { + "type": "list_concat", + "id": "%q9!rgI0aki3+U!L]!(~", + "inputs": { + "A": { + "block": { + "type": "list_index", + "id": "@3Xs|O0{m:9t+:10sdJt", + "inputs": { + "LIST": { + "block": { + "type": "variables_get", + "id": "p*0cvM===VYCc7Gh9e@:", + "fields": { + "VAR": { + "name": "pc_value" + } + } + } + }, + "INDEX": { + "shadow": { + "type": "math_number", + "id": "8N/WwE0Z8lvRTn2{{QDV", + "fields": { + "NUM": 0 + } + } + } + } + } + }, + "B": { + "block": { + "type": "list_range", + "id": "xWR6~Cnb*AKTbHA#X.tt", + "fields": { + "FROM": 3, + "ORDER": "downto", + "TO": 1 + }, + "inputs": { + "LIST": { + "block": { + "type": "list_index", + "id": "ROTzG?tL@KCgf^g]GEIE", + "inputs": { + "LIST": { + "block": { + "type": "variables_get", + "id": "CY^]U$%-K-O2pa=b4{-C", + "fields": { + "VAR": { + "name": "reg" + } + } + } + }, + "INDEX": { + "shadow": { + "type": "math_number", + "id": "@n.jCM3eFOYn:-dpl*w,", + "fields": { + "NUM": 0 + } + }, + "block": { + "type": "variables_get", + "id": "}$~Wr;:0#in.Dj,lJq8Z", + "fields": { + "VAR": { + "name": "pc_src1" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + }, + "ELSE": { + "block": { + "type": "variables_set_index", + "id": "#Y:^S-=xSz;1X)K#P*jQ", + "fields": { + "VAR": { + "name": "reg" + } + }, + "inputs": { + "INDEX": { + "shadow": { + "type": "math_number", + "id": "qQE)5qtryHFc9FK@VO-Z", + "fields": { + "NUM": 0 + } + }, + "block": { + "type": "variables_get", + "id": "I=wm^8VeOn:h?Iw6%]qC", + "fields": { + "VAR": { + "name": "pc_dest" + } + } + } + }, + "VALUE": { + "block": { + "type": "list_concat", + "id": "s)xGIy|=1?u:`,1aA*jI", + "inputs": { + "A": { + "block": { + "type": "list_range", + "id": "xW.}3$P{8KS}kdlNU7[V", + "fields": { + "FROM": 2, + "ORDER": "downto", + "TO": 0 + }, + "inputs": { + "LIST": { + "block": { + "type": "list_index", + "id": "sywVG,ed}yXHTe9[LbJG", + "inputs": { + "LIST": { + "block": { + "type": "variables_get", + "id": "49KV]4AgQiH~sRI!NC;_", + "fields": { + "VAR": { + "name": "reg" + } + } + } + }, + "INDEX": { + "shadow": { + "type": "math_number", + "id": "@n.jCM3eFOYn:-dpl*w,", + "fields": { + "NUM": 0 + } + }, + "block": { + "type": "variables_get", + "id": "T^;XCr}fGl3p!pE$fKno", + "fields": { + "VAR": { + "name": "pc_src1" + } + } + } + } + } + } + } + } + } + }, + "B": { + "block": { + "type": "list_index", + "id": "CL:UeG}32+P2P*Ug2%1#", + "inputs": { + "LIST": { + "block": { + "type": "variables_get", + "id": "x^5[BaKMJ!dm]Bj$-NIJ", + "fields": { + "VAR": { + "name": "pc_value" + } + } + } + }, + "INDEX": { + "shadow": { + "type": "math_number", + "id": "+%JHc8{ItMG-XAA}Btg`", + "fields": { + "NUM": 0 + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + }, + "next": { + "block": { + "type": "controls_when", + "id": "5S8U`[bAu$O@329*Asbh", + "inputs": { + "TEST": { + "block": { + "type": "value_std_logic_vector", + "id": "SE6W70drr+O2Bf.9R7P4", + "fields": { + "VALUE": "1011" + } + } + }, + "body": { + "block": { + "type": "controls_if", + "id": "(tUQx-.s:hWj[DZ=Bm;M", + "extraState": { + "hasElse": true + }, + "inputs": { + "IF0": { + "block": { + "type": "logic_compare", + "id": "zGxHk*Xy.|-iBNmMm+is", + "fields": { + "OP": "EQ" + }, + "inputs": { + "A": { + "block": { + "type": "list_index", + "id": "=0AY}8fb6TG20P3xXw??", + "inputs": { + "LIST": { + "block": { + "type": "variables_get", + "id": "PvBPN(DsU%*t@TxGJJ-L", + "fields": { + "VAR": { + "name": "reg" + } + } + } + }, + "INDEX": { + "shadow": { + "type": "math_number", + "id": "@n.jCM3eFOYn:-dpl*w,", + "fields": { + "NUM": 0 + } + }, + "block": { + "type": "variables_get", + "id": ";U6I51YNmH?By=xOo2P#", + "fields": { + "VAR": { + "name": "pc_src1" + } + } + } + } + } + } + }, + "B": { + "block": { + "type": "list_index", + "id": "[~p@kCIM:J`0/gw9UZbU", + "inputs": { + "LIST": { + "block": { + "type": "variables_get", + "id": "UVEqR^8pL{wuyoiRBR]V", + "fields": { + "VAR": { + "name": "reg" + } + } + } + }, + "INDEX": { + "shadow": { + "type": "math_number", + "id": "@n.jCM3eFOYn:-dpl*w,", + "fields": { + "NUM": 0 + } + }, + "block": { + "type": "variables_get", + "id": "?])(=RIh;8h2d#8Wc,RS", + "fields": { + "VAR": { + "name": "pc_src2" + } + } + } + } + } + } + } + } + } + }, + "DO0": { + "block": { + "type": "variables_set", + "id": "R^%Fk,tm@YELN:dK#UP!", + "fields": { + "VAR": { + "name": "eif" + } + }, + "inputs": { + "VALUE": { + "block": { + "type": "value_std_logic", + "id": "SRxNCnx[vV;KIr#wuTNJ", + "fields": { + "VALUE": 1 + } + } + } + } + } + }, + "ELSE": { + "block": { + "type": "math_change", + "id": "O;)YNKl=h:SVo2dAjORp", + "fields": { + "VAR": { + "name": "pc" + } + }, + "inputs": { + "DELTA": { + "block": { + "type": "math_number", + "id": "RySOjPM(^J/X=+b1;%2]", + "fields": { + "NUM": 2 + } + } + } + } + } + } + } + } + } + }, + "next": { + "block": { + "type": "controls_when", + "id": "I$I#~T)U(VaQFnCTmBw=", + "inputs": { + "TEST": { + "block": { + "type": "value_std_logic_vector", + "id": "(^O~PmP?:!q`{X.i`G#8", + "fields": { + "VALUE": "1100" + } + } + }, + "body": { + "block": { + "type": "controls_if", + "id": "Z;[~E.r_@^L=*3!5N|4r", + "extraState": { + "hasElse": true + }, + "inputs": { + "IF0": { + "block": { + "type": "logic_compare", + "id": "0uMVP$^x],CwZ/BbEzn$", + "fields": { + "OP": "GT" + }, + "inputs": { + "A": { + "block": { + "type": "list_index", + "id": "t,o#oMTPhm^9,aQ8fPg3", + "inputs": { + "LIST": { + "block": { + "type": "variables_get", + "id": "sb/G]B.c-Y9dT_JK.9)V", + "fields": { + "VAR": { + "name": "reg" + } + } + } + }, + "INDEX": { + "shadow": { + "type": "math_number", + "id": "@n.jCM3eFOYn:-dpl*w,", + "fields": { + "NUM": 0 + } + }, + "block": { + "type": "variables_get", + "id": "E9)Rg1B]cmM9MHVFO.?1", + "fields": { + "VAR": { + "name": "pc_src1" + } + } + } + } + } + } + }, + "B": { + "block": { + "type": "list_index", + "id": "a`1$xMBz!p75:mBVAz/s", + "inputs": { + "LIST": { + "block": { + "type": "variables_get", + "id": ",KsR8J)f[`WV!=}?sNj5", + "fields": { + "VAR": { + "name": "reg" + } + } + } + }, + "INDEX": { + "shadow": { + "type": "math_number", + "id": "@n.jCM3eFOYn:-dpl*w,", + "fields": { + "NUM": 0 + } + }, + "block": { + "type": "variables_get", + "id": "eF3*T93PJI2e,uLzQJ|N", + "fields": { + "VAR": { + "name": "pc_src2" + } + } + } + } + } + } + } + } + } + }, + "DO0": { + "block": { + "type": "variables_set", + "id": "e!kLbbGH3*I%fQy4`/Xs", + "fields": { + "VAR": { + "name": "eif" + } + }, + "inputs": { + "VALUE": { + "block": { + "type": "value_std_logic", + "id": "Unc29..kr{5H@5n/=,O`", + "fields": { + "VALUE": 1 + } + } + } + } + } + }, + "ELSE": { + "block": { + "type": "math_change", + "id": ":FOWwaC;s9!Xlxe=0rnq", + "fields": { + "VAR": { + "name": "pc" + } + }, + "inputs": { + "DELTA": { + "block": { + "type": "math_number", + "id": "!,ri`{pam,KjTHd)3SF6", + "fields": { + "NUM": 2 + } + } + } + } + } + } + } + } + } + }, + "next": { + "block": { + "type": "controls_when", + "id": "c|KWgNGZPpmg3`Adshwo", + "inputs": { + "TEST": { + "block": { + "type": "value_std_logic_vector", + "id": "pjHl5-)n`W]r*b]Z=wg=", + "fields": { + "VALUE": "1101" + } + } + }, + "body": { + "block": { + "type": "controls_if", + "id": "=H6g,-h6I)x]3T0J}ixz", + "extraState": { + "hasElse": true + }, + "inputs": { + "IF0": { + "block": { + "type": "logic_compare", + "id": "ijb6+xta};qf26XAj_aD", + "fields": { + "OP": "GTE" + }, + "inputs": { + "A": { + "block": { + "type": "list_index", + "id": "bSJC-!mn2YaO|LOZ_%Rc", + "inputs": { + "LIST": { + "block": { + "type": "variables_get", + "id": "6eM-ARWxf}6xWC}0weH,", + "fields": { + "VAR": { + "name": "reg" + } + } + } + }, + "INDEX": { + "shadow": { + "type": "math_number", + "id": "@n.jCM3eFOYn:-dpl*w,", + "fields": { + "NUM": 0 + } + }, + "block": { + "type": "variables_get", + "id": "A[MoEghhY_HF7s4;roGU", + "fields": { + "VAR": { + "name": "pc_src1" + } + } + } + } + } + } + }, + "B": { + "block": { + "type": "list_index", + "id": "I/7t,!p$?@k.KI^VR,OB", + "inputs": { + "LIST": { + "block": { + "type": "variables_get", + "id": "Fe+jrFZ[*)J{)Y=mb2sK", + "fields": { + "VAR": { + "name": "reg" + } + } + } + }, + "INDEX": { + "shadow": { + "type": "math_number", + "id": "@n.jCM3eFOYn:-dpl*w,", + "fields": { + "NUM": 0 + } + }, + "block": { + "type": "variables_get", + "id": "6@}S]ymkEY$@t[SdL.[$", + "fields": { + "VAR": { + "name": "pc_src2" + } + } + } + } + } + } + } + } + } + }, + "DO0": { + "block": { + "type": "variables_set", + "id": "79$cGsJ)rxp?d[}MUEDF", + "fields": { + "VAR": { + "name": "eif" + } + }, + "inputs": { + "VALUE": { + "block": { + "type": "value_std_logic", + "id": "L}PTgZAw8T7;-et)1lH1", + "fields": { + "VALUE": 1 + } + } + } + } + } + }, + "ELSE": { + "block": { + "type": "math_change", + "id": "+j+|kJ9$uRmG_MsM]fmJ", + "fields": { + "VAR": { + "name": "pc" + } + }, + "inputs": { + "DELTA": { + "block": { + "type": "math_number", + "id": "V5C6z-0}Q+aJvPhwsL9T", + "fields": { + "NUM": 2 + } + } + } + } + } + } + } + } + } + }, + "next": { + "block": { + "type": "controls_when", + "id": "y`sF@bMs2Qb9OkTmo{-4", + "inputs": { + "TEST": { + "block": { + "type": "value_std_logic_vector", + "id": "`5c(YzUk=pJ3i4,$wpZQ", + "fields": { + "VALUE": "1110" + } + } + }, + "body": { + "block": { + "type": "variables_set", + "id": "{!~EAu;9Suq1svy[V37s", + "fields": { + "VAR": { + "name": "wi" + } + }, + "inputs": { + "VALUE": { + "block": { + "type": "ieee.numeric_std.unsigned", + "id": "o`.kdj#p!SR*/Ht[,eKV", + "inputs": { + "NUM": { + "block": { + "type": "list_range", + "id": "%q(qDIW8KgMLp.-9`9w=", + "fields": { + "FROM": 8, + "ORDER": "downto", + "TO": 0 + }, + "inputs": { + "LIST": { + "block": { + "type": "variables_get", + "id": "]#Pf^gP#6;P:Gk,f))xX", + "fields": { + "VAR": { + "name": "pc_value" + } + } + } + } + } + } + } + } + } + } + } + } + } + }, + "next": { + "block": { + "type": "controls_when", + "id": "UL~ce88$3BzE*P(JV1vk", + "inputs": { + "TEST": { + "block": { + "type": "value_std_logic_vector", + "id": "A;acYa6pvYU).p4$6#7U", + "fields": { + "VALUE": "1111" + } + } + }, + "body": { + "block": { + "type": "variables_set", + "id": "oMpHUbkOnjREm.I%%{Ni", + "fields": { + "VAR": { + "name": "pc" + } + }, + "inputs": { + "VALUE": { + "block": { + "type": "list_range", + "id": "8eg~@SpKE*,uWUgG(!F7", + "fields": { + "FROM": 8, + "ORDER": "downto", + "TO": 0 + }, + "inputs": { + "LIST": { + "block": { + "type": "variables_get", + "id": "8u/j-=evq7N3oA{b1V4H", + "fields": { + "VAR": { + "name": "pc_value" + } + } + } + } + } + } + } + }, + "next": { + "block": { + "type": "variables_set", + "id": "k!F@ASO)%ofy}dK;U$9T", + "fields": { + "VAR": { + "name": "eif" + } + }, + "inputs": { + "VALUE": { + "block": { + "type": "value_std_logic", + "id": "hq=WR.!h,O[J%|tejI9p", + "fields": { + "VALUE": 0 + } + } + } + } + } + } + } + } + }, + "next": { + "block": { + "type": "controls_when", + "id": "b#5OdP*=ZcB]GT]EDL:Z", + "inputs": { + "TEST": { + "block": { + "type": "logic_others", + "id": "MvCP^~,qm5]sw1v|J`+`" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + }, + { + "type": "process_direct_set", + "id": "Wx[kE9B@oPQaJls-xl)G", + "x": -2288, + "y": -1187, + "fields": { + "VAR": { + "name": "leds" + } + }, + "inputs": { + "VALUE": { + "block": { + "type": "list_index", + "id": "JY/v(waMZp(@B}IyUfL]", + "inputs": { + "LIST": { + "block": { + "type": "variables_get", + "id": "`2Z_I:e0-6tt3sSofoC6", + "fields": { + "VAR": { + "name": "reg" + } + } + } + }, + "INDEX": { + "shadow": { + "type": "math_number", + "id": "`u4)^`C!4iYQfT-iU/ht", + "fields": { + "NUM": 7 + } + } + } + } + } + } + } + }, + { + "type": "process_direct_set", + "id": "vmu!Qk;kfChyWJOeCxC@", + "x": -2287, + "y": -1111, + "fields": { + "VAR": { + "name": "pc_value" + } + }, + "inputs": { + "VALUE": { + "block": { + "type": "list_index", + "id": "py-os0zC8|qj!juS0kuc", + "inputs": { + "LIST": { + "block": { + "type": "constant", + "id": "yR8-xF4sEUi+K-LI)t:v", + "fields": { + "NAME": "code" + } + } + }, + "INDEX": { + "shadow": { + "type": "math_number", + "id": "yA._~)I?08I(eTnmM(GU", + "fields": { + "NUM": 0 + } + }, + "block": { + "type": "ieee.numeric_std.to_integer", + "id": ":eCLv`lnx49EjIgS(qta", + "inputs": { + "NUM": { + "block": { + "type": "ieee.numeric_std.unsigned", + "id": "G.bL9cxw0ip)d:ufN7,S", + "inputs": { + "NUM": { + "block": { + "type": "variables_get", + "id": "s]WYRdP.(8GTa?n=2d.o", + "fields": { + "VAR": { + "name": "pc" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + }, + { + "type": "process_direct_set", + "id": "eUaL5q$0,l/tV(6_+K,?", + "x": -2288, + "y": -1012, + "fields": { + "VAR": { + "name": "pc_op" + } + }, + "inputs": { + "VALUE": { + "block": { + "type": "list_range", + "id": "jm..@f#/r8LSuY;!@Z5@", + "fields": { + "FROM": 12, + "ORDER": "downto", + "TO": 9 + }, + "inputs": { + "LIST": { + "block": { + "type": "variables_get", + "id": "(7]Z+QI{n3*x*``EQrU5", + "fields": { + "VAR": { + "name": "pc_value" + } + } + } + } + } + } + } + } + }, + { + "type": "process_direct_set", + "id": "e%Dg9X!X_D|5nK$u9#Ae", + "x": -2286, + "y": -937, + "fields": { + "VAR": { + "name": "pc_dest" + } + }, + "inputs": { + "VALUE": { + "block": { + "type": "ieee.numeric_std.to_integer", + "id": "29_oSIxR?eX4)8{=5i;K", + "inputs": { + "NUM": { + "block": { + "type": "ieee.numeric_std.unsigned", + "id": "Kr^:U}|uJE#,O{.j}:q:", + "inputs": { + "NUM": { + "block": { + "type": "list_range", + "id": "|*PTztUm7YX:R@eH*y7r", + "fields": { + "FROM": 8, + "ORDER": "downto", + "TO": 6 + }, + "inputs": { + "LIST": { + "block": { + "type": "variables_get", + "id": "Txh9JF{%nt}xR+*{XSpo", + "fields": { + "VAR": { + "name": "pc_value" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + }, + { + "type": "process_direct_set", + "id": "wXoL*:nk%:TWFSZY+A+]", + "x": -2286, + "y": -837, + "fields": { + "VAR": { + "name": "pc_src1" + } + }, + "inputs": { + "VALUE": { + "block": { + "type": "ieee.numeric_std.to_integer", + "id": "u[C@W;[`?bRCV!trxm1Q", + "inputs": { + "NUM": { + "block": { + "type": "ieee.numeric_std.unsigned", + "id": "k3W-D!|`So25X,x=N=4H", + "inputs": { + "NUM": { + "block": { + "type": "list_range", + "id": "gt/wX%kU1wzN`d]?xxzk", + "fields": { + "FROM": 5, + "ORDER": "downto", + "TO": 3 + }, + "inputs": { + "LIST": { + "block": { + "type": "variables_get", + "id": "@P5@^K.LW;1Y$W=FKeT*", + "fields": { + "VAR": { + "name": "pc_value" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + }, + { + "type": "process_direct_set", + "id": "BC[wJX,jj0=88#)Hdw*y", + "x": -2287, + "y": -738, + "fields": { + "VAR": { + "name": "pc_src2" + } + }, + "inputs": { + "VALUE": { + "block": { + "type": "ieee.numeric_std.to_integer", + "id": "tY=7hVc`?8{yb*Pm(1S{", + "inputs": { + "NUM": { + "block": { + "type": "ieee.numeric_std.unsigned", + "id": "AbNwznnF1(rw+OUvVdTx", + "inputs": { + "NUM": { + "block": { + "type": "list_range", + "id": "EqqHN6E%{wGMp656(phy", + "fields": { + "FROM": 2, + "ORDER": "downto", + "TO": 0 + }, + "inputs": { + "LIST": { + "block": { + "type": "variables_get", + "id": "WfC5i/ZiX~p8YWqbkZC{", + "fields": { + "VAR": { + "name": "pc_value" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + ] + }, + "variables": [ + { + "name": "clk", + "id": "%+n,:#VbB(@kT^y6[w8@" + }, + { + "name": "reset", + "id": "(w(]5m*(eHVFc7UUhuMp" + }, + { + "name": "incr", + "id": ";bOiFOzy/{}N8!zBX}.u" + }, + { + "name": "buttons", + "id": "FfhY}1:7Uh#%uz=D~/h)" + }, + { + "name": "leds", + "id": "(OZR3:mGI_kT5)!,?cg*" + }, + { + "name": "pc", + "id": "O_#EE)om~|[Y@z~~[~N*" + }, + { + "name": "pc_value", + "id": "TI4,U=,SY9HKZhXQs=Wj" + }, + { + "name": "pc_op", + "id": "7;4bU%qx,-QxUuNm5yi*" + }, + { + "name": "pc_dest", + "id": "3~P9sOCf`PuhZKz+qGPB" + }, + { + "name": "pc_src1", + "id": "dlXrUCa@5Yd3}h8:R9H/" + }, + { + "name": "pc_src2", + "id": "aA`;[hu}/AdjFE=`.lF2" + }, + { + "name": "wi", + "id": "JUo@%6fA3Ttz*ZOjK@k=" + }, + { + "name": "eif", + "id": ",I(O|A@=x]$$Sk=-e*^+" + }, + { + "name": "reg", + "id": "](3wR=IKW)..UPF(ORvo" + } + ] +} diff --git a/scratch-vhdl-vscode/media/main.js b/scratch-vhdl-vscode/media/main.js index fced80d..b08a2ca 100644 --- a/scratch-vhdl-vscode/media/main.js +++ b/scratch-vhdl-vscode/media/main.js @@ -929,29 +929,197 @@ document.addEventListener('DOMContentLoaded', function () { Blockly.dialog.setPrompt((m, a, cb) => prompt(m).then((d) => cb(d ?? a))); Blockly.dialog.setConfirm((m, cb) => confirm(m).then((d) => cb(d ?? false))); - const entityVars = {}; - const aliasVars = {}; + const field_variables = []; (() => { Blockly.fieldRegistry.unregister("field_variable"); - Blockly.fieldRegistry.register("field_variable", Blockly.FieldVariable = class extends Blockly.FieldVariable { - renderSelectedText_() { - super.renderSelectedText_(); - if (["variables_get", "variables_set", "variables_set_index", "math_change", "process_direct_set"].indexOf(this.sourceBlock_.type) !== -1) { - if (Object.keys(entityVars).indexOf(this.value_) !== -1) this.sourceBlock_.setColour(20); - else if (Object.keys(aliasVars).indexOf(this.value_) !== -1) this.sourceBlock_.setColour(120); - else this.sourceBlock_.setColour('%{BKY_VARIABLES_HUE}'); + Blockly.fieldRegistry.register("field_variable", Blockly.FieldVariable = class extends Blockly.FieldDropdown { + constructor( + varName, + opt_config) { + super(Blockly.Field.SKIP_SETUP); + + this.defaultType_ = ''; + this.SERIALIZABLE = true; + this.var = varName; + + this.menuGenerator_ = Blockly.FieldVariable.dropdownCreate; + + this.defaultVariableName = typeof varName === 'string' ? varName : ''; + + this.size_ = new Blockly.utils.Size(0, 0); + + if (varName === Blockly.Field.SKIP_SETUP) { + return; + } + + if (opt_config) { + this.configure_(opt_config); } + + field_variables.push(this); + } + + configure_(config) { + super.configure_(config); } initModel() { - if (!this.variable_) { + const block = this.getSourceBlock(); + if (!block) { + throw new UnattachedFieldError(); + } + if (!this.var) if (this.defaultVariableName === "") { - this.doValueUpdate_(this.getSourceBlock().workspace.getAllVariables()[0].getId()); + this.doValueUpdate_(Object.keys(entity.entity)[0]); } else { - super.initModel(); + // Don't call setValue because we don't want to cause a rerender. + this.doValueUpdate_(this.defaultVariableName); + } + } + + shouldAddBorderRect_() { + const block = this.getSourceBlock(); + if (!block) { + throw new UnattachedFieldError(); + } + return super.shouldAddBorderRect_() && + (!this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW || + block.type !== 'variables_get'); + } + + saveState(doFullSerialization) { + // Make sure the variable is initialized. + this.initModel(); + const state = { name: this.var }; + return state; + } + + loadState(state) { + const block = this.getSourceBlock(); + if (!block) { + throw new UnattachedFieldError(); + } + // This is necessary so that blocks in the flyout can have custom var names. + this.setValue(state.name || Blockly.getMainWorkspace().getVariableById(state.id).name); + } + + setSourceBlock(block) { + if (block.isShadow()) { + throw Error('Variable fields are not allowed to exist on shadow blocks.'); + } + super.setSourceBlock(block); + } + + setValue(a) { + this.var = a; + super.setValue(a); + } + + getValue() { + return this.var; + } + + getText() { + return this.var; + } + + doValueUpdate_(newId) { + const block = this.getSourceBlock(); + if (!block) { + throw new UnattachedFieldError(); + } + this.var = newId; + super.doValueUpdate_(newId); + this.refreshVariableName(); + } + + refreshVariableName() { + this.forceRerender(); + } + + onItemSelected_(menu, menuItem) { + const id = menuItem.getValue(); + // Handle special cases. + if (this.sourceBlock_ && !this.sourceBlock_.isDeadOrDying()) { + if (id === "DELETE_VARIABLE_ID") { + if (entity.signals[this.var]) + delete entity.signals[this.var]; + else if (entity.aliases[this.var]) { + delete entity.aliases[this.var]; + } else if (entity.entity[this.var]) { + delete entity.entity[this.var]; + } + vscode.postMessage({ + type: "updateEntity", + body: JSON.stringify(entity) + }); + } else if (id === "RENAME_VARIABLE_ID") { + if (entity.signals[this.var]) { + entity.signals[prompt("New name:", this.var)] = entity.signals[this.var]; + delete entity.signals[this.var]; + } else if (entity.aliases[this.var]) { + entity.aliases[prompt("New name:", this.var)] = entity.aliases[this.var]; + delete entity.aliases[this.var]; + } else if (entity.entity[this.var]) { + entity.entity[prompt("New name:", this.var)] = entity.entity[this.var]; + delete entity.entity[this.var]; + } + vscode.postMessage({ + type: "updateEntity", + body: JSON.stringify(entity) + }); } } + // Handle unspecial case. + this.setValue(id); + } + + referencesVariables() { + return true; + } + + static fromJson(options) { + return new this(null, options); + } + + static dropdownCreate() { + if (!this.var) { + throw Error( + 'Tried to call dropdownCreate on a variable field with no' + + ' variable selected.'); + } + const name = this.getText(); + let variableModelList = []; + if (this.sourceBlock_ && !this.sourceBlock_.isDeadOrDying()) { + variableModelList = variableModelList.concat(Object.keys(entity.entity), Object.keys(entity.aliases), Object.keys(entity.signals)); + } + variableModelList.sort(); + + const options = []; + for (let i = 0; i < variableModelList.length; i++) { + // Set the UUID as the internal representation of the variable. + options[i] = [variableModelList[i], variableModelList[i]]; + } + options.push( + [Blockly.Msg['RENAME_VARIABLE'], "RENAME_VARIABLE_ID"]); + if (Blockly.Msg['DELETE_VARIABLE']) { + options.push([ + Blockly.Msg['DELETE_VARIABLE'].replace('%1', name), + "DELETE_VARIABLE_ID", + ]); + } + + return options; + } + + renderSelectedText_() { + super.renderSelectedText_(); + if (["variables_get", "variables_set", "variables_set_index", "math_change", "process_direct_set"].indexOf(this.sourceBlock_.type) !== -1) { + if (Object.keys(entity.entity).indexOf(this.getValue()) !== -1) this.sourceBlock_.setColour(20); + else if (Object.keys(entity.aliases).indexOf(this.getValue()) !== -1) this.sourceBlock_.setColour(120); + else this.sourceBlock_.setColour('%{BKY_VARIABLES_HUE}'); + } } }); })(); @@ -994,7 +1162,7 @@ document.addEventListener('DOMContentLoaded', function () { Generator.finish = function (generator, code) { function gen_signals(signals) { return Object.keys(signals).map((n) => - "\n signal " + n + " : " + signals[n] + ";" + "\n signal " + n + " : " + signals[n][0] + (signals[n][1] ? (" := " + signals[n][1]) : "") + ";" ).join(""); } return librariesCode + "\n\n" + entityCode + "\n\n\narchitecture scratch of " + name + " is\n" + constantsCode + "\n" + gen_signals(entity.signals) + "\n" + aliasesCode + "\n\nbegin\n" + Object.getPrototypeOf(generator).finish.call(generator, code) + "\n\nend architecture;\n"; @@ -1035,7 +1203,7 @@ document.addEventListener('DOMContentLoaded', function () { .fieldRow.filter( (a) => a instanceof Blockly.FieldVariable ).map( - (a) => a.getVariable().name + (a) => a.getText() ).join(", ")) + "\n begin\n " + generator.statementToCode(block, 'body').replaceAll("\n", "\n ") + "end process;"; @@ -1046,7 +1214,7 @@ document.addEventListener('DOMContentLoaded', function () { } Generator.process_direct_set = function (generator, block) { - return "\n " + block.getField("VAR").getVariable().name + ' <= ' + + return "\n " + block.getField("VAR").getText() + ' <= ' + generator.valueToCode(block, 'VALUE', generator.ORDER_NONE) + ';'; } @@ -1090,7 +1258,7 @@ document.addEventListener('DOMContentLoaded', function () { } Generator.logic_rising_edge = function (generator, block) { - return ["rising_edge(" + block.getField("dep").getVariable().name + ")", generator.ORDER_FUNCTION_CALL] + return ["rising_edge(" + block.getField("dep").getText() + ")", generator.ORDER_FUNCTION_CALL] } Generator.logic_not = function (generator, block) { @@ -1115,7 +1283,7 @@ document.addEventListener('DOMContentLoaded', function () { } Generator.variables_get = function (generator, block) { - return [block.getField("VAR").getVariable().name, generator.ORDER_ATOMIC]; + return [block.getField("VAR").getText(), generator.ORDER_ATOMIC]; } Generator.constant = function (generator, block) { @@ -1123,18 +1291,18 @@ document.addEventListener('DOMContentLoaded', function () { } Generator.variables_set = function (generator, block) { - return block.getField("VAR").getVariable().name + ' <= ' + + return block.getField("VAR").getText() + ' <= ' + generator.valueToCode(block, 'VALUE', generator.ORDER_NONE) + ';\n'; } Generator.variables_set_index = function (generator, block) { - return block.getField("VAR").getVariable().name + "(" + generator.valueToCode(block, 'INDEX', generator.ORDER_NONE) + ') <= ' + + return block.getField("VAR").getText() + "(" + generator.valueToCode(block, 'INDEX', generator.ORDER_NONE) + ') <= ' + generator.valueToCode(block, 'VALUE', generator.ORDER_NONE) + ';\n'; } Generator.math_change = function (generator, block) { - return block.getField("VAR").getVariable().name + ' <= ' + - block.getField("VAR").getVariable().name + " + " + generator.valueToCode(block, 'DELTA', generator.ORDER_ADD) + ';\n'; + return block.getField("VAR").getText() + ' <= ' + + block.getField("VAR").getText() + " + " + generator.valueToCode(block, 'DELTA', generator.ORDER_ADD) + ';\n'; } Generator.value_std_logic = function (generator, block) { @@ -1433,7 +1601,7 @@ document.addEventListener('DOMContentLoaded', function () { function table_modal(columns, data) { return new Promise((resolve) => { - const isArray = Object.values(data)[0] instanceof Array; + const isArray = columns.length > 2; const modal = document.createElement("dialog"); const table = document.createElement("table"); @@ -1447,16 +1615,21 @@ document.addEventListener('DOMContentLoaded', function () { }); table.appendChild(cs); + const s = {}; + const rows = []; Object.keys(data).forEach((r, i) => { const a = document.createElement("tr"); + a.setAttribute("data-id", i); + s[i] = r; + const rem = document.createElement("td"); const remb = document.createElement("button"); remb.innerText = "-"; remb.addEventListener("click", () => { table.deleteRow(1 + i); - rows.splice(i, 1); + delete rows[i]; }); rem.appendChild(remb); a.appendChild(rem); @@ -1503,12 +1676,14 @@ document.addEventListener('DOMContentLoaded', function () { const i = rows.length; const a = document.createElement("tr"); + a.setAttribute("data-id", i); + const rem = document.createElement("td"); const remb = document.createElement("button"); remb.innerText = "-"; remb.addEventListener("click", () => { table.deleteRow(1 + i); - rows.splice(i, 1); + delete rows[i]; }); rem.appendChild(remb); a.appendChild(rem); @@ -1517,6 +1692,7 @@ document.addEventListener('DOMContentLoaded', function () { const n = document.createElement("td"); const ni = document.createElement("input"); + ni.setAttribute("data-name", "true"); ni.type = "text"; cols.push(ni); n.appendChild(ni); @@ -1551,11 +1727,17 @@ document.addEventListener('DOMContentLoaded', function () { modal.removeEventListener("close", () => (modal.remove(), resolve(data))); modal.close(); modal.remove(); + const changed = (a, b) => ({ + created: Object.keys(b).filter((k) => !a.hasOwnProperty(k)).map((k) => b[k]), + renamed: Object.keys(a).filter((k) => b.hasOwnProperty(k) && a[k] !== b[k]).map((k) => [a[k], b[k]]), + deleted: Object.keys(a).filter((k) => !b.hasOwnProperty(k)).map((k) => a[k]), + }); + const changes = changed(s, [...table.getElementsByTagName("tr")].map(tag => [tag.getAttribute("data-id"), tag.querySelector("tr td input[data-name~=true]").value])); if (isArray) { const arraySplit = (array) => [array[0], array.slice(1)]; - resolve(Object.fromEntries(rows.map((cols) => arraySplit(cols.map(c => c.value))))); + resolve({ data: Object.fromEntries(rows.filter(v => v != null).map((cols) => arraySplit(cols.map(c => c.value)))), changes }); } else { - resolve(Object.fromEntries(rows.map((cols) => cols.map(c => c.value)))); + resolve({ data: Object.fromEntries(rows.filter(v => v != null).map((cols) => cols.map(c => c.value))), changes }); } }); modal.appendChild(submit); @@ -1563,18 +1745,43 @@ document.addEventListener('DOMContentLoaded', function () { document.body.appendChild(modal); modal.setAttribute("hidden", "true"); modal.showModal(); - modal.addEventListener("close", () => (modal.remove(), resolve(data))); + modal.addEventListener("close", () => (modal.remove(), resolve({ + data, change: { + created: [], + renamed: [], + deleted: [] + } + }))); }) } + const makeChanges = (changes, c = false) => { + const renamed = Object.fromEntries(changes.renamed); + if (c) Blockly.getMainWorkspace().getBlocksByType("constant").forEach(block => { + if (renamed.hasOwnProperty(block.getField("NAME").getValue())) { + block.getField("NAME").setValue(renamed[block.getField("NAME").getValue()]); + } else if (changes.deleted.includes(block.getField("NAME").getValue())) { + block.checkAndDelete(); + } + }); + else field_variables.forEach(field_variable => { + if (renamed.hasOwnProperty(field_variable.getValue())) { + field_variable.setValue(renamed[field_variable.getValue()]); + } else if (changes.deleted.includes(field_variable.getValue())) { + field_variable.sourceBlock_.checkAndDelete(); + } + }); + }; + Blockly.ContextMenuRegistry.registry.register({ displayText: "Edit ports", preconditionFn() { return "enabled"; }, callback() { - table_modal(["name", "direction", "type"], entity.entity).then((data) => { + table_modal(["name", "direction", "type"], entity.entity).then(({ data, changes }) => { entity.entity = data; + makeChanges(changes); vscode.postMessage({ type: "updateEntity", body: JSON.stringify(entity) @@ -1583,7 +1790,7 @@ document.addEventListener('DOMContentLoaded', function () { }, scopeType: Blockly.ContextMenuRegistry.ScopeType.WORKSPACE, id: 'editPorts', - weight: 9, + weight: 9.0, }); Blockly.ContextMenuRegistry.registry.register({ @@ -1592,8 +1799,9 @@ document.addEventListener('DOMContentLoaded', function () { return "enabled"; }, callback() { - table_modal(["name", "type"], entity.signals).then((data) => { + table_modal(["name", "type", "value"], entity.signals).then(({ data, changes }) => { entity.signals = data; + makeChanges(changes); vscode.postMessage({ type: "updateEntity", body: JSON.stringify(entity) @@ -1602,7 +1810,7 @@ document.addEventListener('DOMContentLoaded', function () { }, scopeType: Blockly.ContextMenuRegistry.ScopeType.WORKSPACE, id: 'editSignals', - weight: 9.0, + weight: 9.1, }); Blockly.ContextMenuRegistry.registry.register({ @@ -1611,8 +1819,9 @@ document.addEventListener('DOMContentLoaded', function () { return "enabled"; }, callback() { - table_modal(["name", "type", "value"], entity.constants).then((data) => { + table_modal(["name", "type", "value"], entity.constants).then(({ data, changes }) => { entity.constants = data; + makeChanges(changes, true); vscode.postMessage({ type: "updateEntity", body: JSON.stringify(entity) @@ -1621,7 +1830,7 @@ document.addEventListener('DOMContentLoaded', function () { }, scopeType: Blockly.ContextMenuRegistry.ScopeType.WORKSPACE, id: 'editConstants', - weight: 9.0, + weight: 9.2, }); Blockly.ContextMenuRegistry.registry.register({ @@ -1630,8 +1839,9 @@ document.addEventListener('DOMContentLoaded', function () { return "enabled"; }, callback() { - table_modal(["name", "value"], entity.aliases).then((data) => { + table_modal(["name", "value"], entity.aliases).then(({ data, changes }) => { entity.aliases = data; + makeChanges(changes); vscode.postMessage({ type: "updateEntity", body: JSON.stringify(entity) @@ -1640,7 +1850,7 @@ document.addEventListener('DOMContentLoaded', function () { }, scopeType: Blockly.ContextMenuRegistry.ScopeType.WORKSPACE, id: 'editAliases', - weight: 9.0, + weight: 9.3, }); let name = "hi"; @@ -1668,9 +1878,6 @@ document.addEventListener('DOMContentLoaded', function () { // })); function generateEntity() { Blockly.Events.disable(); - for (const n in entity.entity) { - entityVars[ws.createVariable(n).id_] = n; - } // rerender all variable fields ws.getAllBlocks().forEach((b) => b.inputList.forEach((c) => c.fieldRow.forEach((d) => d instanceof Blockly.FieldVariable && d.renderSelectedText_()))); Blockly.Events.enable(); @@ -1684,9 +1891,6 @@ document.addEventListener('DOMContentLoaded', function () { } function generateAliases() { Blockly.Events.disable(); - for (const n in entity.aliases) { - aliasVars[ws.createVariable(n).id_] = n; - } // rerender all variable fields ws.getAllBlocks().forEach((b) => b.inputList.forEach((c) => c.fieldRow.forEach((d) => d instanceof Blockly.FieldVariable && d.renderSelectedText_()))); Blockly.Events.enable(); @@ -1696,25 +1900,23 @@ document.addEventListener('DOMContentLoaded', function () { "\n alias " + n + " is " + entity.aliases[n] + ";" ).join(""); } - function generateSignals() { - Blockly.Events.disable(); - Object.keys(entity.signals).forEach(signal => ws.createVariable(signal)); - Blockly.Events.enable(); - } window.addEventListener('message', (message) => message.data.type == "contentUpdate" && ( Blockly.Events.disable(), Blockly.serialization.workspaces.load(JSON.parse(message.data.body), ws, { registerUndo: false }), Blockly.Events.enable(), - generateEntity(), generateAliases(), generateSignals() + generateEntity(), generateAliases() )); window.addEventListener('message', async (message) => { if (message.data.type == "entity") { - const oldLibs = JSON.stringify(entity?.libraries || {}); entity = JSON.parse(message.data.body); name = entity.name || message.data.file_name; entity.signals = entity.signals || {}; + Object.keys(entity.signals) + .forEach(s => + entity.signals[s] = entity.signals[s] instanceof Array ? + entity.signals[s] : [entity.signals[s], ""]); entity.constants = entity.constants || {}; entity.aliases = entity.aliases || {}; entity.libraries = entity.libraries || {}; @@ -1823,35 +2025,6 @@ document.addEventListener('DOMContentLoaded', function () { if (e.oldInputName && !e.newInputName) return; if (e.type == Blockly.Events.BLOCK_CREATE) return; - if (e.type == Blockly.Events.VAR_DELETE) { - if (entity.signals[e.varName]) - delete entity.signals[e.varName]; - else if (entity.aliases[e.varName]) { - delete entity.aliases[e.varName]; - } else if (entity.entity[e.varName]) { - delete entity.entity[e.varName]; - } - vscode.postMessage({ - type: "updateEntity", - body: JSON.stringify(entity) - }); - } else if (e.type == Blockly.Events.VAR_RENAME) { - if (entity.signals[e.oldName]) { - entity.signals[e.newName] = entity.signals[e.oldName]; - delete entity.signals[e.oldName]; - } else if (entity.aliases[e.varName]) { - entity.aliases[e.newName] = entity.aliases[e.oldName]; - delete entity.aliases[e.oldName]; - } else if (entity.entity[e.varName]) { - entity.entity[e.newName] = entity.entity[e.oldName]; - delete entity.entity[e.oldName]; - } - vscode.postMessage({ - type: "updateEntity", - body: JSON.stringify(entity) - }); - } - vscode.postMessage({ type: "update", body: [JSON.stringify(Blockly.serialization.workspaces.save(ws)), VHDLGenerator.workspaceToCode(ws)]