diff options
author | Sunil Shetye | 2018-06-07 17:48:55 +0530 |
---|---|---|
committer | Sunil Shetye | 2018-06-07 17:48:55 +0530 |
commit | 75a3a91595f06a1ac7d8ccc0a1ca0b5cd9552abf (patch) | |
tree | 2b584d8b6062684bd18beab96c5de019bd9c81c9 /macros/IntegerOp | |
parent | f97e60278c61e42308c32047109fcb983ded8dcd (diff) | |
download | sci2js-75a3a91595f06a1ac7d8ccc0a1ca0b5cd9552abf.tar.gz sci2js-75a3a91595f06a1ac7d8ccc0a1ca0b5cd9552abf.tar.bz2 sci2js-75a3a91595f06a1ac7d8ccc0a1ca0b5cd9552abf.zip |
add macros from scicos_blocks from scilab 5.5.2
Diffstat (limited to 'macros/IntegerOp')
-rw-r--r-- | macros/IntegerOp/BITCLEAR.sci | 120 | ||||
-rw-r--r-- | macros/IntegerOp/BITSET.sci | 116 | ||||
-rw-r--r-- | macros/IntegerOp/CONVERT.sci | 403 | ||||
-rw-r--r-- | macros/IntegerOp/DFLIPFLOP.sci | 1758 | ||||
-rw-r--r-- | macros/IntegerOp/DLATCH.sci | 534 | ||||
-rw-r--r-- | macros/IntegerOp/EXTRACTBITS.sci | 275 | ||||
-rw-r--r-- | macros/IntegerOp/INTMUL.sci | 137 | ||||
-rw-r--r-- | macros/IntegerOp/JKFLIPFLOP.sci | 833 | ||||
-rw-r--r-- | macros/IntegerOp/LOGIC.sci | 96 | ||||
-rw-r--r-- | macros/IntegerOp/SHIFT.sci | 152 | ||||
-rw-r--r-- | macros/IntegerOp/SRFLIPFLOP.sci | 451 |
11 files changed, 4875 insertions, 0 deletions
diff --git a/macros/IntegerOp/BITCLEAR.sci b/macros/IntegerOp/BITCLEAR.sci new file mode 100644 index 00000000..07462283 --- /dev/null +++ b/macros/IntegerOp/BITCLEAR.sci @@ -0,0 +1,120 @@ +// Xcos +// +// Copyright (C) INRIA - METALAU Project <scicos@inria.fr> +// Copyright (C) 2011 - Bernard DUJARDIN <bernard.dujardin@contrib.scilab.org> +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// See the file ../license.txt +// + +function [x,y,typ]=BITCLEAR(job,arg1,arg2) + x=[]; + y=[]; + typ=[]; + select job + case "set" then + x=arg1; + graphics=arg1.graphics; + exprs=graphics.exprs + model=arg1.model; + while %t do + + [ok,Datatype,bit,exprs]=scicos_getvalue([msprintf(gettext("Set %s block parameters"), "BITCLEAR"); " "; gettext("Clear a bit");" "],.. + [msprintf(gettext("Data Type %s"), "(3:int32, 4:int16, 5:int8, ...)"); gettext("Index of Bit (0 is least significant)")],.. + list("vec",1,"vec",1), exprs); + + if ~ok then + break, + end + in=[model.in model.in2]; + + if floor(bit) <> bit then + block_parameter_error(msprintf(gettext("Wrong type for ''%s'' parameter: %5.1f."), gettext("Index of Bit"), bit), .. + gettext("Must be integer.") .. + ); + ok=%f; + elseif (Datatype == 3) | (Datatype == 6) then + if bit > 31 | bit < 0 then + block_parameter_error(msprintf(gettext("Wrong value for ''%s'' parameter: %d."), gettext("Index of Bit"), bit), .. + msprintf(gettext("Must be in the interval %s."), "[0, 31]")); + ok=%f; + else + bit=uint32(bit) + n=(2^32-1)-2^bit; + n=uint32(n) + model.sim=list("bit_clear_32",4) + end + elseif (Datatype == 4)|(Datatype == 7) then + if bit > 15 | bit < 0 then + block_parameter_error(msprintf(gettext("Wrong value for ''%s'' parameter: %d."), gettext("Index of Bit"), bit), .. + msprintf(gettext("Must be in the interval %s."), "[0, 15]")); + ok=%f; + else + bit=uint16(bit) + n=(2^16-1)-2^bit; + n=uint16(n) + model.sim=list("bit_clear_16",4) + end + elseif (Datatype == 5)|(Datatype == 8) then + if bit > 7 | bit < 0 then + block_parameter_error(msprintf(gettext("Wrong value for ''%s'' parameter: %d."), gettext("Index of Bit"), bit), .. + msprintf(gettext("Must be in the interval %s."), "[0, 7]")); + ok=%f; + else + bit=uint8(bit) + n=(2^8-1)-2^bit; + n=uint8(n) + model.sim=list("bit_clear_8",4) + end + else + block_parameter_error(msprintf(gettext( "Wrong value for ''%s'' parameter: %d."), gettext("Data Type"), Datatype),.. + msprintf(gettext( "Must be in the interval %s."), "[3, 8]")); + ok=%f; + end + if ok then + it=Datatype + ot=Datatype + out=[1 1] + [model,graphics,ok]=set_io(model,graphics,list(in,it),list(out,ot),[],[]) + end + if ok then + graphics.exprs=exprs; + model.opar=list(n) + x.graphics=graphics; + x.model=model; + break + end + end + + case "define" then + model=scicos_model() + model.sim=list("bit_clear_32",4) + model.in=1 + model.in2=1 + model.out=1 + model.out2=1; + model.intyp=3 + model.outtyp=3 + model.opar=list(int32(0)) + model.blocktype="c" + model.dep_ut=[%t %f] + + exprs=[sci2exp(3);sci2exp(0)] + gr_i=[] + x=standard_define([4 2],model,exprs,gr_i) + + end +endfunction diff --git a/macros/IntegerOp/BITSET.sci b/macros/IntegerOp/BITSET.sci new file mode 100644 index 00000000..58805c2b --- /dev/null +++ b/macros/IntegerOp/BITSET.sci @@ -0,0 +1,116 @@ +// Scicos +// +// Copyright (C) INRIA - METALAU Project <scicos@inria.fr> +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// See the file ../license.txt +// + +function [x,y,typ]=BITSET(job,arg1,arg2) + x=[]; + y=[]; + typ=[]; + select job + case "set" then + x=arg1; + graphics=arg1.graphics; + exprs=graphics.exprs + model=arg1.model; + while %t do + [ok,Datatype,bit,exprs]=scicos_getvalue([msprintf(gettext("Set %s block parameters"), "BITSET");" "; gettext("Set a bit");" "],.. + [msprintf(gettext("Data Type %s"), "(3:int32, 4:int16, 5:int8, ...)"); gettext("Index of Bit (0 is least significant)")],.. + list("vec",1,"vec",1), exprs); + + if ~ok then + break, + end + in=[model.in model.in2]; + + if floor(bit) <> bit then + block_parameter_error(msprintf(gettext("Wrong type for ''%s'' parameter: %5.1f."), gettext("Index of Bit"), bit), .. + gettext("Must be integer.")); + ok=%f; + end + if (Datatype == 3)|(Datatype == 6) then + if bit > 31 | bit < 0 then + block_parameter_error(msprintf(gettext("Wrong value for ''%s'' parameter: %d."), gettext("Index of Bit"), bit), .. + msprintf(gettext("Must be in the interval %s."), "[0, 31]")); + ok=%f; + end + bit=uint32(bit) + n=2^bit; + n=uint32(n) + model.sim=list("bit_set_32",4) + elseif (Datatype==4)|(Datatype==7) then + if bit > 15 | bit < 0 then + block_parameter_error(msprintf(gettext("Wrong value for ''%s'' parameter: %d."), gettext("Index of Bit"), bit), .. + msprintf(gettext("Must be in the interval %s."), "[0, 15]")); + ok=%f; + end + bit=uint16(bit) + n=2^bit; + n=uint16(n) + model.sim=list("bit_set_16",4) + elseif (Datatype==5)|(Datatype==8) then + + if bit > 7 | bit < 0 then + block_parameter_error(msprintf(gettext("Wrong value for ''%s'' parameter: %d."), gettext("Index of Bit"), bit), .. + msprintf(gettext("Must be in the interval %s."), "[0, 7]")); + ok=%f; + end + bit=uint8(bit) + n=2^bit; + n=uint8(n) + model.sim=list("bit_set_8",4) + else + block_parameter_error(msprintf(gettext("Wrong value for ''%s'' parameter: %d."), gettext("Data Type"), Datatype), .. + msprintf(gettext("Must be in the interval %s."), "[3, 8]")); + ok=%f; + end + if ok then + it=Datatype + ot=Datatype + out=[1 1] + [model,graphics,ok]=set_io(model,graphics,list(in,it),list(out,ot),[],[]) + end + if ok then + graphics.exprs=exprs; + model.opar=list(n); + x.graphics=graphics; + x.model=model; + break + end + end + + case "define" then + model=scicos_model() + model.sim=list("bit_set_32",4) + model.in=1 + model.in2=1 + model.out=1 + model.out2=1; + model.intyp=3 + model.outtyp=3 + model.opar=list(uint32(0)) + model.blocktype="c" + model.dep_ut=[%t %f] + + exprs=[sci2exp(3);sci2exp(0)] + gr_i=[] + x=standard_define([4 2],model,exprs,gr_i) + + end +endfunction diff --git a/macros/IntegerOp/CONVERT.sci b/macros/IntegerOp/CONVERT.sci new file mode 100644 index 00000000..e183b492 --- /dev/null +++ b/macros/IntegerOp/CONVERT.sci @@ -0,0 +1,403 @@ +// Scicos +// +// Copyright (C) INRIA - METALAU Project <scicos@inria.fr> +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// See the file ../license.txt +// + +function [x,y,typ]=CONVERT(job,arg1,arg2) + x=[]; + y=[]; + typ=[]; + select job + case "set" then + x=arg1; + graphics=arg1.graphics + model=arg1.model + exprs=graphics.exprs + while %t do + [ok,it,ot,np,exprs] = scicos_getvalue([msprintf(gettext("Set %s block parameters"), "CONVERT");" "; gettext("Type conversion");" "], .. + [gettext("Input Type (1:double, 3:int32, 4:int16, 5:int8, ...)"); gettext("Output Type (1:double, 3:int32, 4:int16, 5:int8, ...)"); .. + gettext("Do on Overflow (0:Nothing, 1:Saturate, 2:Error)")], .. + list("vec",1,"vec",1,"vec",1), exprs); + if ~ok then + break, + end + + if it==2 then + it =1; + end + if ot==2 then + ot=1; + end + + if (np ~= 0 & np ~= 1 & np ~= 2) then + block_parameter_error(msprintf(gettext("Wrong value for ''%s'' parameter: %d."), gettext("Do on Overflow"), np), .. + msprintf(gettext("Must be in the interval %s."), "[0, 2]")); + ok=%f; + elseif (it > 8 | it < 1) then + block_parameter_error(msprintf(gettext("Wrong value for ''%s'' parameter: %d."), gettext("Input Type"), it), .. + msprintf(gettext("Must be in the interval %s."), "[1, 8]")); + ok=%f; + elseif (ot > 8 | ot < 1) then + block_parameter_error(msprintf(gettext("Wrong value for ''%s'' parameter: %d."), gettext("Output Type"), ot), .. + msprintf(gettext("Must be in the interval %s."), "[1, 8]")); + ok=%f; + end + + model.sim=list("convert",4) + if (it==ot) then + model.ipar=1; + else + if (np==0) then + if (it==1) then + if (ot==3) then + model.ipar=2; + elseif (ot==4) then + model.ipar=3; + elseif (ot==5) then + model.ipar=4; + elseif (ot==6) then + model.ipar=5; + elseif (ot==7) then + model.ipar=6; + elseif (ot==8) then + model.ipar=7; + end + elseif (it==3) then + if (ot==1) then + model.ipar=8; + elseif (ot==4) then + model.ipar=9; + elseif (ot==5) then + model.ipar=10; + elseif (ot==6) then + model.ipar=1; + elseif (ot==7) then + model.ipar=11; + elseif (ot==8) then + model.ipar=12; + end + elseif (it==4) then + if (ot==1) then + model.ipar=13; + elseif (ot==3) then + model.ipar=14; + elseif (ot==5) then + model.ipar=15; + elseif (ot==6) then + model.ipar=16; + elseif (ot==7) then + model.ipar=1; + elseif (ot==8) then + model.ipar=17; + end + elseif (it==5) then + if (ot==1) then + model.ipar=18; + elseif (ot==3) then + model.ipar=19; + elseif (ot==4) then + model.ipar=20; + elseif (ot==6) then + model.ipar=21; + elseif (ot==7) then + model.ipar=22; + elseif (ot==8) then + model.ipar=1; + end + elseif (it==6) then + if (ot==1) then + model.ipar=23; + elseif (ot==3) then + model.ipar=1; + elseif (ot==4) then + model.ipar=24; + elseif (ot==5) then + model.ipar=25; + elseif (ot==7) then + model.ipar=26; + elseif (ot==8) then + model.ipar=27; + end + elseif (it==7) then + if (ot==1) then + model.ipar=28; + elseif (ot==3) then + model.ipar=29; + elseif (ot==4) then + model.ipar=1; + elseif (ot==5) then + model.ipar=30; + elseif (ot==6) then + model.ipar=31; + elseif (ot==8) then + model.ipar=32; + end + elseif (it==8) then + if (ot==1) then + model.ipar=33; + elseif (ot==3) then + model.ipar=34; + elseif (ot==4) then + model.ipar=35; + elseif (ot==5) then + model.ipar=1; + elseif (ot==6) then + model.ipar=36; + elseif (ot==7) then + model.ipar=37; + end + end + elseif (np==1) then + if (it==1) then + if (ot==3) then + model.ipar=38; + elseif (ot==4) then + model.ipar=39; + elseif (ot==5) then + model.ipar=40; + elseif (ot==6) then + model.ipar=41; + elseif (ot==7) then + model.ipar=42; + elseif (ot==8) then + model.ipar=43; + end + elseif (it==3) then + if (ot==1) then + model.ipar=8; + elseif (ot==4) then + model.ipar=44; + elseif (ot==5) then + model.ipar=45; + elseif (ot==6) then + model.ipar=46; + elseif (ot==7) then + model.ipar=47; + elseif (ot==8) then + model.ipar=48; + end + elseif (it==4) then + if (ot==1) then + model.ipar=13; + elseif (ot==3) then + model.ipar=14; + elseif (ot==5) then + model.ipar=49; + elseif (ot==6) then + model.ipar=50; + elseif (ot==7) then + model.ipar=51; + elseif (ot==8) then + model.ipar=52; + end + elseif (it==5) then + if (ot==1) then + model.ipar=18; + elseif (ot==3) then + model.ipar=19; + elseif (ot==4) then + model.ipar=20; + elseif (ot==6) then + model.ipar=53; + elseif (ot==7) then + model.ipar=54; + elseif (ot==8) then + model.ipar=55; + end + elseif (it==6) then + if (ot==1) then + model.ipar=23; + elseif (ot==3) then + model.ipar=56; + elseif (ot==4) then + model.ipar=57; + elseif (ot==5) then + model.ipar=58; + elseif (ot==7) then + model.ipar=59; + elseif (ot==8) then + model.ipar=60; + end + elseif (it==7) then + if (ot==1) then + model.ipar=28; + elseif (ot==3) then + model.ipar=29; + elseif (ot==4) then + model.ipar=61; + elseif (ot==5) then + model.ipar=62; + elseif (ot==6) then + model.ipar=31; + elseif (ot==8) then + model.ipar=63; + end + elseif (it==8) then + if (ot==1) then + model.ipar=33; + elseif (ot==3) then + model.ipar=34; + elseif (ot==4) then + model.ipar=35; + elseif (ot==5) then + model.ipar=64; + elseif (ot==6) then + model.ipar=36; + elseif (ot==7) then + model.ipar=37; + end + end + elseif (np==2) then + if (it==1) then + if (ot==3) then + model.ipar=65; + elseif (ot==4) then + model.ipar=66; + elseif (ot==5) then + model.ipar=67; + elseif (ot==6) then + model.ipar=68; + elseif (ot==7) then + model.ipar=69; + elseif (ot==8) then + model.ipar=70; + end + elseif (it==3) then + if (ot==1) then + model.ipar=8; + elseif (ot==4) then + model.ipar=71; + elseif (ot==5) then + model.ipar=72; + elseif (ot==6) then + model.ipar=73; + elseif (ot==7) then + model.ipar=74; + elseif (ot==8) then + model.ipar=75; + end + elseif (it==4) then + if (ot==1) then + model.ipar=13; + elseif (ot==3) then + model.ipar=14; + elseif (ot==5) then + model.ipar=76; + elseif (ot==6) then + model.ipar=77; + elseif (ot==7) then + model.ipar=78; + elseif (ot==8) then + model.ipar=79; + end + elseif (it==5) then + if (ot==1) then + model.ipar=18; + elseif (ot==3) then + model.ipar=19; + elseif (ot==4) then + model.ipar=20; + elseif (ot==6) then + model.ipar=80; + elseif (ot==7) then + model.ipar=81; + elseif (ot==8) then + model.ipar=82; + end + elseif (it==6) then + if (ot==1) then + model.ipar=23; + elseif (ot==3) then + model.ipar=83; + elseif (ot==4) then + model.ipar=84; + elseif (ot==5) then + model.ipar=85; + elseif (ot==7) then + model.ipar=86; + elseif (ot==8) then + model.ipar=87; + end + elseif (it==7) then + if (ot==1) then + model.ipar=28; + elseif (ot==3) then + model.ipar=29; + elseif (ot==4) then + model.ipar=88; + elseif (ot==5) then + model.ipar=89; + elseif (ot==6) then + model.ipar=31; + elseif (ot==8) then + model.ipar=90; + end + elseif (it==8) then + if (ot==1) then + model.ipar=33; + elseif (ot==3) then + model.ipar=34; + elseif (ot==4) then + model.ipar=35; + elseif (ot==5) then + model.ipar=91; + elseif (ot==6) then + model.ipar=36; + elseif (ot==7) then + model.ipar=37; + end + end + end + end + in=[model.in model.in2] + out=[model.out model.out2] + if ok then + [model,graphics,ok]=set_io(model,graphics,... + list(in,it),... + list(out,ot),[],[]) + end + if ok then + graphics.exprs=exprs + x.graphics=graphics; + x.model=model + break + end + end + case "define" then + + sgn=2 + model=scicos_model() + model.sim=list("convert",4) + model.in=-1 + model.out=-1 + model.in2=-2 + model.out2=-2 + model.intyp=1 + model.outtyp=3 + model.rpar=[] + model.ipar=sgn + model.blocktype="c" + model.dep_ut=[%t %f] + + + exprs=[sci2exp(1);sci2exp(3);sci2exp(0)] + gr_i=[] + x=standard_define([3 2],model, exprs,gr_i) + end +endfunction diff --git a/macros/IntegerOp/DFLIPFLOP.sci b/macros/IntegerOp/DFLIPFLOP.sci new file mode 100644 index 00000000..fb62b34c --- /dev/null +++ b/macros/IntegerOp/DFLIPFLOP.sci @@ -0,0 +1,1758 @@ +// Scicos +// +// Copyright (C) INRIA - METALAU Project <scicos@inria.fr> +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// See the file ../license.txt +// + +function [x,y,typ]=DFLIPFLOP(job,arg1,arg2) + // Copyright INRIA + x=[]; + y=[]; + typ=[]; + select job + case "set" then + x=arg1 + case "define" then + scs_m=scicos_diagram(.. + version="scicos4.2",.. + props=scicos_params(.. + wpar=[600,450,0,0,600,450],.. + Title=["DFLIPFLOP"],.. + tol=[0.0001,0.000001,1.000E-10,100001,0,0],.. + tf=100000,.. + context=" ",.. + void1=[],.. + options=tlist(["scsopt","3D","Background","Link","ID","Cmap"],list(%t,33),[8,1],[1,5],.. + list([5,1],[4,1]),[0.8,0.8,0.8]),.. + void2=[],.. + void3=[],.. + doc=list())) + scs_m.objs(1)=scicos_block(.. + gui="CONST_m",.. + graphics=scicos_graphics(.. + orig=[109.62561,263.44465],.. + sz=[20;20],.. + flip=%t,.. + theta=0,.. + exprs="int8(0)",.. + pin=[],.. + pout=6,.. + pein=[],.. + peout=[],.. + gr_i=[],.. + id="",.. + in_implicit=[],.. + out_implicit="E"),.. + model=scicos_model(.. + sim=list("cstblk4_m",4),.. + in=[],.. + in2=[],.. + intyp=1,.. + out=1,.. + out2=1,.. + outtyp=5,.. + evtin=[],.. + evtout=[],.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=[],.. + ipar=[],.. + opar=list(int8(0)),.. + blocktype="d",.. + firing=[],.. + dep_ut=[%f,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m.objs(2)=scicos_block(.. + gui="IFTHEL_f",.. + graphics=scicos_graphics(.. + orig=[239.98293,378.2166],.. + sz=[60,60],.. + flip=%t,.. + theta=0,.. + exprs=["1";"1"],.. + pin=29,.. + pout=[],.. + pein=22,.. + peout=[16;44],.. + gr_i=[],.. + id="",.. + in_implicit="E",.. + out_implicit=[]),.. + model=scicos_model(.. + sim=list("ifthel",-1),.. + in=1,.. + in2=1,.. + intyp=-1,.. + out=[],.. + out2=[],.. + outtyp=1,.. + evtin=1,.. + evtout=[1;1],.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=[],.. + ipar=[],.. + opar=list(),.. + blocktype="l",.. + firing=[-1,-1],.. + dep_ut=[%t,%f],.. + label="",.. + nzcross=1,.. + nmode=1,.. + equations=list()),.. + doc=list()) + scs_m.objs(3)=scicos_block(.. + gui="LOGICAL_OP",.. + graphics=scicos_graphics(.. + orig=[152.88902,260.24498],.. + sz=[60,40],.. + flip=%t,.. + theta=0,.. + exprs=["2";"1";"5";"0"],.. + pin=[11;39],.. + pout=5,.. + pein=[],.. + peout=[],.. + gr_i=[],.. + id="",.. + in_implicit=["E";"E"],.. + out_implicit="E"),.. + model=scicos_model(.. + sim=list("logicalop_i8",4),.. + in=[-1;-1],.. + in2=[-2;-2],.. + intyp=[5;5],.. + out=-1,.. + out2=-2,.. + outtyp=5,.. + evtin=[],.. + evtout=[],.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=[],.. + ipar=[1;0],.. + opar=list(),.. + blocktype="c",.. + firing=[],.. + dep_ut=[%t,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m.objs(4)=scicos_block(.. + gui="SAMPHOLD_m",.. + graphics=scicos_graphics(.. + orig=[233.72156,260.24498],.. + sz=[40,40],.. + flip=%t,.. + theta=0,.. + exprs="5",.. + pin=5,.. + pout=33,.. + pein=42,.. + peout=[],.. + gr_i=[],.. + id="",.. + in_implicit="E",.. + out_implicit="E"),.. + model=scicos_model(.. + sim=list("samphold4_m",4),.. + in=-1,.. + in2=-2,.. + intyp=5,.. + out=-1,.. + out2=-2,.. + outtyp=5,.. + evtin=1,.. + evtout=[],.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=[],.. + ipar=[],.. + opar=list(),.. + blocktype="d",.. + firing=[],.. + dep_ut=[%t,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m.objs(5)=scicos_link(.. + xx=[221.46044;225.15013],.. + yy=[280.24498;280.24498],.. + id="drawlink",.. + thick=[0,0],.. + ct=[1,1],.. + from=[3,1,0],.. + to=[4,1,1]) + scs_m.objs(6)=scicos_link(.. + xx=[138.19704;140.34523],.. + yy=[273.44465;273.49157],.. + id="drawlink",.. + thick=[0,0],.. + ct=[1,1],.. + from=[1,1,0],.. + to=[38,1,1]) + scs_m.objs(7)=scicos_block(.. + gui="LOGICAL_OP",.. + graphics=scicos_graphics(.. + orig=[373.24106,309.46812],.. + sz=[60,40],.. + flip=%t,.. + theta=0,.. + exprs=["1";"5";"5";"0"],.. + pin=36,.. + pout=13,.. + pein=[],.. + peout=[],.. + gr_i=[],.. + id="",.. + in_implicit="E",.. + out_implicit="E"),.. + model=scicos_model(.. + sim=list("logicalop_i8",4),.. + in=-1,.. + in2=-2,.. + intyp=5,.. + out=-1,.. + out2=-2,.. + outtyp=5,.. + evtin=[],.. + evtout=[],.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=[],.. + ipar=[5;0],.. + opar=list(),.. + blocktype="c",.. + firing=[],.. + dep_ut=[%t,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m.objs(8)=scicos_block(.. + gui="IN_f",.. + graphics=scicos_graphics(.. + orig=[199.48466,398.2166],.. + sz=[20,20],.. + flip=%t,.. + theta=0,.. + exprs="3",.. + pin=[],.. + pout=9,.. + pein=[],.. + peout=[],.. + gr_i=[],.. + id="",.. + in_implicit=[],.. + out_implicit="E"),.. + model=scicos_model(.. + sim="input",.. + in=[],.. + in2=[],.. + intyp=1,.. + out=-1,.. + out2=[],.. + outtyp=-1,.. + evtin=[],.. + evtout=[],.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=[],.. + ipar=3,.. + opar=list(),.. + blocktype="c",.. + firing=[],.. + dep_ut=[%f,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m.objs(9)=scicos_link(.. + xx=[219.48466;222.54128],.. + yy=[408.2166;408.2166],.. + id="drawlink",.. + thick=[0,0],.. + ct=[1,1],.. + from=[8,1,0],.. + to=[28,1,1]) + scs_m.objs(10)=scicos_block(.. + gui="IN_f",.. + graphics=scicos_graphics(.. + orig=[104.31759,276.91165],.. + sz=[20,20],.. + flip=%t,.. + theta=0,.. + exprs="1",.. + pin=[],.. + pout=11,.. + pein=[],.. + peout=[],.. + gr_i=[],.. + id="",.. + in_implicit=[],.. + out_implicit="E"),.. + model=scicos_model(.. + sim="input",.. + in=[],.. + in2=[],.. + intyp=1,.. + out=-1,.. + out2=[],.. + outtyp=-1,.. + evtin=[],.. + evtout=[],.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=[],.. + ipar=1,.. + opar=list(),.. + blocktype="c",.. + firing=[],.. + dep_ut=[%f,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m.objs(11)=scicos_link(.. + xx=[124.31759;144.31759],.. + yy=[286.91165;286.91165],.. + id="drawlink",.. + thick=[0,0],.. + ct=[1,1],.. + from=[10,1,0],.. + to=[3,1,1]) + scs_m.objs(12)=scicos_block(.. + gui="OUT_f",.. + graphics=scicos_graphics(.. + orig=[457.40928,320.20131],.. + sz=[20,20],.. + flip=%t,.. + theta=0,.. + exprs="2",.. + pin=13,.. + pout=[],.. + pein=[],.. + peout=[],.. + gr_i=[],.. + id="",.. + in_implicit="E",.. + out_implicit=[]),.. + model=scicos_model(.. + sim="output",.. + in=-1,.. + in2=[],.. + intyp=-1,.. + out=[],.. + out2=[],.. + outtyp=1,.. + evtin=[],.. + evtout=[],.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=[],.. + ipar=2,.. + opar=list(),.. + blocktype="c",.. + firing=[],.. + dep_ut=[%f,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m.objs(13)=scicos_link(.. + xx=[441.81249;457.40928],.. + yy=[329.46812;330.20131],.. + id="drawlink",.. + thick=[0,0],.. + ct=[1,1],.. + from=[7,1,0],.. + to=[12,1,1]) + scs_m.objs(14)=scicos_block(.. + gui="OUT_f",.. + graphics=scicos_graphics(.. + orig=[376.4669,270.83282],.. + sz=[20,20],.. + flip=%t,.. + theta=0,.. + exprs="1",.. + pin=37,.. + pout=[],.. + pein=[],.. + peout=[],.. + gr_i=[],.. + id="",.. + in_implicit="E",.. + out_implicit=[]),.. + model=scicos_model(.. + sim="output",.. + in=-1,.. + in2=[],.. + intyp=-1,.. + out=[],.. + out2=[],.. + outtyp=1,.. + evtin=[],.. + evtout=[],.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=[],.. + ipar=1,.. + opar=list(),.. + blocktype="c",.. + firing=[],.. + dep_ut=[%f,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m_1=scicos_diagram(.. + version="scicos4.2",.. + props=scicos_params(.. + wpar=[600,450,0,0,600,450],.. + Title="Untitled",.. + tol=[0.0001,0.000001,1.000E-10,100001,0,0],.. + tf=100000,.. + context=[],.. + void1=[],.. + options=tlist(["scsopt","3D","Background","Link","ID","Cmap"],list(%t,33),[8,1],[1,5],.. + list([5,1],[4,1]),[0.8,0.8,0.8]),.. + void2=[],.. + void3=[],.. + doc=list())) + scs_m_1.objs(1)=scicos_block(.. + gui="ANDLOG_f",.. + graphics=scicos_graphics(.. + orig=[194,133],.. + sz=[60,60],.. + flip=%t,.. + theta=0,.. + exprs=[],.. + pin=[],.. + pout=9,.. + pein=[4;11],.. + peout=[],.. + gr_i=[],.. + id="",.. + in_implicit=[],.. + out_implicit="E"),.. + model=scicos_model(.. + sim="andlog",.. + in=[],.. + in2=[],.. + intyp=1,.. + out=1,.. + out2=[],.. + outtyp=1,.. + evtin=[1;1],.. + evtout=[],.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=[],.. + ipar=[],.. + opar=list(),.. + blocktype="d",.. + firing=[],.. + dep_ut=[%f,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m_1.objs(2)=scicos_block(.. + gui="CLKIN_f",.. + graphics=scicos_graphics(.. + orig=[149,287],.. + sz=[20,20],.. + flip=%t,.. + theta=0,.. + exprs="1",.. + pin=[],.. + pout=[],.. + pein=[],.. + peout=4,.. + gr_i=[],.. + id="",.. + in_implicit=[],.. + out_implicit=[]),.. + model=scicos_model(.. + sim="input",.. + in=[],.. + in2=[],.. + intyp=1,.. + out=[],.. + out2=[],.. + outtyp=1,.. + evtin=[],.. + evtout=1,.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=[],.. + ipar=1,.. + opar=list(),.. + blocktype="d",.. + firing=-1,.. + dep_ut=[%f,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m_1.objs(3)=scicos_block(.. + gui="CLKOUT_f",.. + graphics=scicos_graphics(.. + orig=[450,83],.. + sz=[20,20],.. + flip=%t,.. + theta=0,.. + exprs="1",.. + pin=[],.. + pout=[],.. + pein=8,.. + peout=[],.. + gr_i=[],.. + id="",.. + in_implicit=[],.. + out_implicit=[]),.. + model=scicos_model(.. + sim="output",.. + in=[],.. + in2=[],.. + intyp=1,.. + out=[],.. + out2=[],.. + outtyp=1,.. + evtin=1,.. + evtout=[],.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=[],.. + ipar=1,.. + opar=list(),.. + blocktype="d",.. + firing=[],.. + dep_ut=[%f,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m_1.objs(4)=scicos_link(.. + xx=[169;214;214],.. + yy=[297;297;198.71],.. + id="drawlink",.. + thick=[0,0],.. + ct=[5,-1],.. + from=[2,1],.. + to=[1,1]) + scs_m_1.objs(5)=scicos_block(.. + gui="CLKIN_f",.. + graphics=scicos_graphics(.. + orig=[141,330],.. + sz=[20,20],.. + flip=%t,.. + theta=0,.. + exprs="2",.. + pin=[],.. + pout=[],.. + pein=[],.. + peout=6,.. + gr_i=[],.. + id="",.. + in_implicit=[],.. + out_implicit=[]),.. + model=scicos_model(.. + sim="input",.. + in=[],.. + in2=[],.. + intyp=1,.. + out=[],.. + out2=[],.. + outtyp=1,.. + evtin=[],.. + evtout=1,.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=[],.. + ipar=2,.. + opar=list(),.. + blocktype="d",.. + firing=-1,.. + dep_ut=[%f,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m_1.objs(6)=scicos_link(.. + xx=[161;234;234],.. + yy=[340;340;275.78],.. + id="drawlink",.. + thick=[0,0],.. + ct=[5,-1],.. + from=[5,1],.. + to=[10,1]) + scs_m_1.objs(7)=scicos_block(.. + gui="IFTHEL_f",.. + graphics=scicos_graphics(.. + orig=[331,137],.. + sz=[60,60],.. + flip=%t,.. + theta=0,.. + exprs=["1";"1"],.. + pin=9,.. + pout=[],.. + pein=12,.. + peout=[8;0],.. + gr_i=[],.. + id="",.. + in_implicit="E",.. + out_implicit=[]),.. + model=scicos_model(.. + sim=list("ifthel",-1),.. + in=1,.. + in2=1,.. + intyp=-1,.. + out=[],.. + out2=[],.. + outtyp=1,.. + evtin=1,.. + evtout=[1;1],.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=[],.. + ipar=[],.. + opar=list(),.. + blocktype="l",.. + firing=[-1,-1],.. + dep_ut=[%t,%f],.. + label="",.. + nzcross=1,.. + nmode=1,.. + equations=list()),.. + doc=list()) + scs_m_1.objs(8)=scicos_link(.. + xx=[351;351;450],.. + yy=[131.29;93;93],.. + id="drawlink",.. + thick=[0,0],.. + ct=[5,-1],.. + from=[7,1],.. + to=[3,1]) + scs_m_1.objs(9)=scicos_link(.. + xx=[262.57;322.43],.. + yy=[163;167],.. + id="drawlink",.. + thick=[0,0],.. + ct=[1,1],.. + from=[1,1],.. + to=[7,1]) + scs_m_1.objs(10)=scicos_block(.. + gui="CLKSPLIT_f",.. + graphics=scicos_graphics(.. + orig=[234;275.78348],.. + sz=[0.3333333,0.3333333],.. + flip=%t,.. + theta=0,.. + exprs=[],.. + pin=[],.. + pout=[],.. + pein=6,.. + peout=[11;12],.. + gr_i=[],.. + id="",.. + in_implicit=[],.. + out_implicit=[]),.. + model=scicos_model(.. + sim="split",.. + in=[],.. + in2=[],.. + intyp=1,.. + out=[],.. + out2=[],.. + outtyp=1,.. + evtin=1,.. + evtout=[1;1],.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=[],.. + ipar=[],.. + opar=list(),.. + blocktype="d",.. + firing=[%f,%f,%f],.. + dep_ut=[%f,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m_1.objs(11)=scicos_link(.. + xx=[234;234],.. + yy=[275.78;198.71],.. + id="drawlink",.. + thick=[0,0],.. + ct=[5,-1],.. + from=[10,1],.. + to=[1,2]) + scs_m_1.objs(12)=scicos_link(.. + xx=[234;361;361],.. + yy=[275.78;275.78;202.71],.. + id="drawlink",.. + thick=[0,0],.. + ct=[5,-1],.. + from=[10,2],.. + to=[7,1]) + scs_m.objs(15)=scicos_block(.. + gui="ANDBLK",.. + graphics=scicos_graphics(.. + orig=[233.73039,318.74407],.. + sz=[40,40],.. + flip=%t,.. + theta=0,.. + exprs=[],.. + pin=[],.. + pout=[],.. + pein=[19;16],.. + peout=17,.. + gr_i=[],.. + id="",.. + in_implicit=[],.. + out_implicit=[]),.. + model=scicos_model(.. + sim="csuper",.. + in=[],.. + in2=[],.. + intyp=1,.. + out=[],.. + out2=[],.. + outtyp=1,.. + evtin=[1;1],.. + evtout=1,.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=scs_m_1,.. + ipar=[],.. + opar=list(),.. + blocktype="h",.. + firing=%f,.. + dep_ut=[%f,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m.objs(16)=scicos_link(.. + xx=[259.98293;260.39705],.. + yy=[372.50232;364.45835],.. + id="drawlink",.. + thick=[0,0],.. + ct=[5,-1],.. + from=[2,1,0],.. + to=[15,2,1]) + scs_m.objs(17)=scicos_link(.. + xx=[253.73039;253.72572],.. + yy=[313.02978;309.29537],.. + id="drawlink",.. + thick=[0,0],.. + ct=[5,-1],.. + from=[15,1,0],.. + to=[41,1,1]) + scs_m_1=scicos_diagram(.. + version="scicos4.2",.. + props=scicos_params(.. + wpar=[600,450,0,0,600,450],.. + Title=["EDGE_TRIGGER","./"],.. + tol=[0.0001;0.000001;1.000E-10;100001;0;0;0],.. + tf=30,.. + context=" ",.. + void1=[],.. + options=tlist(["scsopt","3D","Background","Link","ID","Cmap"],list(%t,33),[8,1],[1,5],.. + list([5,1],[4,1]),[0.8,0.8,0.8]),.. + void2=[],.. + void3=[],.. + doc=list())) + scs_m_1.objs(1)=scicos_block(.. + gui="EDGETRIGGER",.. + graphics=scicos_graphics(.. + orig=[288.58631,257.1131],.. + sz=[60,40],.. + flip=%t,.. + theta=0,.. + exprs="1",.. + pin=5,.. + pout=3,.. + pein=[],.. + peout=[],.. + gr_i=[],.. + id="",.. + in_implicit="E",.. + out_implicit="E"),.. + model=scicos_model(.. + sim=list("edgetrig",4),.. + in=1,.. + in2=[],.. + intyp=1,.. + out=1,.. + out2=[],.. + outtyp=1,.. + evtin=[],.. + evtout=[],.. + state=[],.. + dstate=0,.. + odstate=list(),.. + rpar=[],.. + ipar=1,.. + opar=list(),.. + blocktype="c",.. + firing=[],.. + dep_ut=[%t,%f],.. + label="",.. + nzcross=1,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m_1.objs(2)=scicos_block(.. + gui="IFTHEL_f",.. + graphics=scicos_graphics(.. + orig=[388.28869,247.1131],.. + sz=[60,60],.. + flip=%t,.. + theta=0,.. + exprs=["0";"0"],.. + pin=3,.. + pout=[],.. + pein=[],.. + peout=[7;0],.. + gr_i=[],.. + id="",.. + in_implicit="E",.. + out_implicit=[]),.. + model=scicos_model(.. + sim=list("ifthel",-1),.. + in=1,.. + in2=[],.. + intyp=1,.. + out=[],.. + out2=1,.. + outtyp=[],.. + evtin=[],.. + evtout=[1;1],.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=[],.. + ipar=[],.. + opar=list(),.. + blocktype="l",.. + firing=[-1,-1],.. + dep_ut=[%t,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m_1.objs(3)=scicos_link(.. + xx=[357.15774;362.99107;379.71726],.. + yy=[277.1131;277.1131;277.1131],.. + id="drawlink",.. + thick=[0,0],.. + ct=[1,1],.. + from=[1,1,0],.. + to=[2,1,1]) + scs_m_1.objs(4)=scicos_block(.. + gui="IN_f",.. + graphics=scicos_graphics(.. + orig=[240.01488,267.1131],.. + sz=[20,20],.. + flip=%t,.. + theta=0,.. + exprs="1",.. + pin=[],.. + pout=5,.. + pein=[],.. + peout=[],.. + gr_i=[],.. + id="",.. + in_implicit=[],.. + out_implicit="E"),.. + model=scicos_model(.. + sim="input",.. + in=[],.. + in2=[],.. + intyp=-1,.. + out=-1,.. + out2=[],.. + outtyp=1,.. + evtin=[],.. + evtout=[],.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=[],.. + ipar=1,.. + opar=list(),.. + blocktype="c",.. + firing=[],.. + dep_ut=[%f,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m_1.objs(5)=scicos_link(.. + xx=[260.01488;280.01488],.. + yy=[277.1131;277.1131],.. + id="drawlink",.. + thick=[0,0],.. + ct=[1,1],.. + from=[4,1,0],.. + to=[1,1,1]) + scs_m_1.objs(6)=scicos_block(.. + gui="CLKOUTV_f",.. + graphics=scicos_graphics(.. + orig=[398.28869,181.39881],.. + sz=[20,30],.. + flip=%t,.. + theta=0,.. + exprs="1",.. + pin=[],.. + pout=[],.. + pein=7,.. + peout=[],.. + gr_i=[],.. + id="",.. + in_implicit=[],.. + out_implicit=[]),.. + model=scicos_model(.. + sim="output",.. + in=[],.. + in2=[],.. + intyp=1,.. + out=[],.. + out2=[],.. + outtyp=1,.. + evtin=1,.. + evtout=[],.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=[],.. + ipar=1,.. + opar=list(),.. + blocktype="d",.. + firing=[],.. + dep_ut=[%f,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m_1.objs(7)=scicos_link(.. + xx=[408.28869;408.28869],.. + yy=[241.39881;211.39881],.. + id="drawlink",.. + thick=[0,0],.. + ct=[5,-1],.. + from=[2,1,0],.. + to=[6,1,1]) + scs_m.objs(18)=scicos_block(.. + gui="EDGE_TRIGGER",.. + graphics=scicos_graphics(.. + orig=[133.90637,385.342],.. + sz=[60,40],.. + flip=%t,.. + theta=0,.. + exprs=[],.. + pin=26,.. + pout=[],.. + pein=[],.. + peout=19,.. + gr_i=[],.. + id="",.. + in_implicit="E",.. + out_implicit=[]),.. + model=scicos_model(.. + sim="csuper",.. + in=-1,.. + in2=[],.. + intyp=1,.. + out=[],.. + out2=[],.. + outtyp=1,.. + evtin=[],.. + evtout=1,.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=scs_m_1,.. + ipar=[],.. + opar=list(),.. + blocktype="h",.. + firing=[],.. + dep_ut=[%f,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m.objs(19)=scicos_link(.. + xx=[163.90637;163.90637;247.06372],.. + yy=[379.62771;364.45835;364.45835],.. + id="drawlink",.. + thick=[0,0],.. + ct=[5,-1],.. + from=[18,1,0],.. + to=[15,1,1]) + scs_m.objs(20)=scicos_block(.. + gui="IN_f",.. + graphics=scicos_graphics(.. + orig=[79.594811,395.47647],.. + sz=[20,20],.. + flip=%t,.. + theta=0,.. + exprs="2",.. + pin=[],.. + pout=23,.. + pein=[],.. + peout=[],.. + gr_i=[],.. + id="",.. + in_implicit=[],.. + out_implicit="E"),.. + model=scicos_model(.. + sim="input",.. + in=[],.. + in2=[],.. + intyp=1,.. + out=-1,.. + out2=[],.. + outtyp=-1,.. + evtin=[],.. + evtout=[],.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=[],.. + ipar=2,.. + opar=list(),.. + blocktype="c",.. + firing=[],.. + dep_ut=[%f,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m_1=scicos_diagram(.. + version="scicos4.2",.. + props=scicos_params(.. + wpar=[600,450,0,0,600,450],.. + Title=["Extract_Activation","./"],.. + tol=[0.0001;0.000001;1.000E-10;100001;0;0;0],.. + tf=30,.. + context=" ",.. + void1=[],.. + options=tlist(["scsopt","3D","Background","Link","ID","Cmap"],list(%t,33),[8,1],[1,5],.. + list([5,1],[4,1]),[0.8,0.8,0.8]),.. + void2=[],.. + void3=[],.. + doc=list())) + scs_m_1.objs(1)=scicos_block(.. + gui="IFTHEL_f",.. + graphics=scicos_graphics(.. + orig=[150.65045,143.82208],.. + sz=[60,60],.. + flip=%t,.. + theta=0,.. + exprs=["0";"0"],.. + pin=6,.. + pout=[],.. + pein=[],.. + peout=[3;4],.. + gr_i=[],.. + id="",.. + in_implicit="E",.. + out_implicit=[]),.. + model=scicos_model(.. + sim=list("ifthel",-1),.. + in=1,.. + in2=[],.. + intyp=1,.. + out=[],.. + out2=[],.. + outtyp=1,.. + evtin=[],.. + evtout=[1;1],.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=[],.. + ipar=[],.. + opar=list(),.. + blocktype="l",.. + firing=[-1,-1],.. + dep_ut=[%t,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m_1.objs(2)=scicos_block(.. + gui="CLKSOMV_f",.. + graphics=scicos_graphics(.. + orig=[169.82143,96.146231],.. + sz=[16.666667,16.666667],.. + flip=%t,.. + theta=0,.. + exprs=[],.. + pin=[],.. + pout=[],.. + pein=[3;4;0],.. + peout=8,.. + gr_i=[],.. + id="",.. + in_implicit=[],.. + out_implicit=[]),.. + model=scicos_model(.. + sim="sum",.. + in=[],.. + in2=[],.. + intyp=1,.. + out=[],.. + out2=[],.. + outtyp=1,.. + evtin=[1;1;1],.. + evtout=1,.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=[],.. + ipar=[],.. + opar=list(),.. + blocktype="d",.. + firing=-1,.. + dep_ut=[%f,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m_1.objs(3)=scicos_link(.. + xx=[170.65045;170.65045;150.04302;150.04302;169.82143],.. + yy=[138.10779;128.235;128.235;104.47956;104.47956],.. + id="drawlink",.. + thick=[0,0],.. + ct=[5,-1],.. + from=[1,1,0],.. + to=[2,1,1]) + scs_m_1.objs(4)=scicos_link(.. + xx=[190.65045;190.65045;178.15476],.. + yy=[138.10779;111.55729;112.8129],.. + id="drawlink",.. + thick=[0,0],.. + ct=[5,-1],.. + from=[1,2,0],.. + to=[2,2,1]) + scs_m_1.objs(5)=scicos_block(.. + gui="IN_f",.. + graphics=scicos_graphics(.. + orig=[102.07902,163.82208],.. + sz=[20,20],.. + flip=%t,.. + theta=0,.. + exprs="1",.. + pin=[],.. + pout=6,.. + pein=[],.. + peout=[],.. + gr_i=[],.. + id="",.. + in_implicit=[],.. + out_implicit="E"),.. + model=scicos_model(.. + sim="input",.. + in=[],.. + in2=[],.. + intyp=-1,.. + out=-1,.. + out2=[],.. + outtyp=1,.. + evtin=[],.. + evtout=[],.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=[],.. + ipar=1,.. + opar=list(),.. + blocktype="c",.. + firing=[],.. + dep_ut=[%f,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m_1.objs(6)=scicos_link(.. + xx=[122.07902;142.07902],.. + yy=[173.82208;173.82208],.. + id="drawlink",.. + thick=[0,0],.. + ct=[1,1],.. + from=[5,1,0],.. + to=[1,1,1]) + scs_m_1.objs(7)=scicos_block(.. + gui="CLKOUTV_f",.. + graphics=scicos_graphics(.. + orig=[168.15476,38.527183],.. + sz=[20,30],.. + flip=%t,.. + theta=0,.. + exprs="1",.. + pin=[],.. + pout=[],.. + pein=8,.. + peout=[],.. + gr_i=[],.. + id="",.. + in_implicit=[],.. + out_implicit=[]),.. + model=scicos_model(.. + sim="output",.. + in=[],.. + in2=[],.. + intyp=1,.. + out=[],.. + out2=[],.. + outtyp=1,.. + evtin=1,.. + evtout=[],.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=[],.. + ipar=1,.. + opar=list(),.. + blocktype="d",.. + firing=[],.. + dep_ut=[%f,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m_1.objs(8)=scicos_link(.. + xx=[178.15476;178.15476],.. + yy=[98.527183;68.527183],.. + id="drawlink",.. + thick=[0,0],.. + ct=[5,-1],.. + from=[2,1,0],.. + to=[7,1,1]) + scs_m.objs(21)=scicos_block(.. + gui="Extract_Activation",.. + graphics=scicos_graphics(.. + orig=[239.82193,456.57677],.. + sz=[60,40],.. + flip=%t,.. + theta=0,.. + exprs=[],.. + pin=31,.. + pout=[],.. + pein=[],.. + peout=22,.. + gr_i=[],.. + id="",.. + in_implicit="E",.. + out_implicit=[]),.. + model=scicos_model(.. + sim="csuper",.. + in=-1,.. + in2=[],.. + intyp=1,.. + out=[],.. + out2=[],.. + outtyp=1,.. + evtin=[],.. + evtout=1,.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=scs_m_1,.. + ipar=[],.. + opar=list(),.. + blocktype="h",.. + firing=[],.. + dep_ut=[%f,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m.objs(22)=scicos_link(.. + xx=[269.82193;269.98293],.. + yy=[450.86248;443.93089],.. + id="drawlink",.. + thick=[0,0],.. + ct=[5,-1],.. + from=[21,1,0],.. + to=[2,1,1]) + scs_m.objs(23)=scicos_link(.. + xx=[99.594811;110.25582],.. + yy=[405.47647;405.42077],.. + id="drawlink",.. + thick=[0,0],.. + ct=[1,1],.. + from=[20,1,0],.. + to=[25,1,1]) + scs_m.objs(24)=scicos_block(.. + gui="SUM_f",.. + graphics=scicos_graphics(.. + orig=[200.5252,469.13173],.. + sz=[16.666667,16.666667],.. + flip=%t,.. + theta=0,.. + exprs=[],.. + pin=[27;0;30],.. + pout=31,.. + pein=[],.. + peout=[],.. + gr_i=[],.. + id="",.. + in_implicit=["E";"E";"E"],.. + out_implicit="E"),.. + model=scicos_model(.. + sim=list("plusblk",2),.. + in=[-1;-1;-1],.. + in2=[],.. + intyp=1,.. + out=-1,.. + out2=[],.. + outtyp=1,.. + evtin=[],.. + evtout=[],.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=[],.. + ipar=[],.. + opar=list(),.. + blocktype="c",.. + firing=[],.. + dep_ut=[%t,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m.objs(25)=scicos_block(.. + gui="SPLIT_f",.. + graphics=scicos_graphics(.. + orig=[110.25582;405.42077],.. + sz=[0.3333333,0.3333333],.. + flip=%t,.. + theta=0,.. + exprs=[],.. + pin=23,.. + pout=[26;27],.. + pein=[],.. + peout=[],.. + gr_i=[],.. + id="",.. + in_implicit="E",.. + out_implicit=["E";"E";"E"]),.. + model=scicos_model(.. + sim="lsplit",.. + in=-1,.. + in2=[],.. + intyp=1,.. + out=[-1;-1;-1],.. + out2=[],.. + outtyp=1,.. + evtin=[],.. + evtout=[],.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=[],.. + ipar=[],.. + opar=list(),.. + blocktype="c",.. + firing=[],.. + dep_ut=[%t,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m.objs(26)=scicos_link(.. + xx=[110.25582;114.33667;125.33494],.. + yy=[405.42077;405.39945;405.342],.. + id="drawlink",.. + thick=[0,0],.. + ct=[1,1],.. + from=[25,1,0],.. + to=[18,1,1]) + scs_m.objs(27)=scicos_link(.. + xx=[110.25582;110.25582;208.85853],.. + yy=[405.42077;469.13173;469.13173],.. + id="drawlink",.. + thick=[0,0],.. + ct=[1,1],.. + from=[25,2,0],.. + to=[24,1,1]) + scs_m.objs(28)=scicos_block(.. + gui="SPLIT_f",.. + graphics=scicos_graphics(.. + orig=[222.54128;408.2166],.. + sz=[0.3333333,0.3333333],.. + flip=%t,.. + theta=0,.. + exprs=[],.. + pin=9,.. + pout=[29;30],.. + pein=[],.. + peout=[],.. + gr_i=[],.. + id="",.. + in_implicit="E",.. + out_implicit=["E";"E";"E"]),.. + model=scicos_model(.. + sim="lsplit",.. + in=-1,.. + in2=[],.. + intyp=1,.. + out=[-1;-1;-1],.. + out2=[],.. + outtyp=1,.. + evtin=[],.. + evtout=[],.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=[],.. + ipar=[],.. + opar=list(),.. + blocktype="c",.. + firing=[],.. + dep_ut=[%t,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m.objs(29)=scicos_link(.. + xx=[222.54128;231.4115],.. + yy=[408.2166;408.2166],.. + id="drawlink",.. + thick=[0,0],.. + ct=[1,1],.. + from=[28,1,0],.. + to=[2,1,1]) + scs_m.objs(30)=scicos_link(.. + xx=[222.54128;222.54128;208.85853;208.85853],.. + yy=[408.2166;453.0015;453.0015;485.7984],.. + id="drawlink",.. + thick=[0,0],.. + ct=[1,1],.. + from=[28,2,0],.. + to=[24,3,1]) + scs_m.objs(31)=scicos_link(.. + xx=[219.57282;231.2505],.. + yy=[477.46506;476.57677],.. + id="drawlink",.. + thick=[0,0],.. + ct=[1,1],.. + from=[24,1,0],.. + to=[21,1,1]) + scs_m.objs(32)=scicos_block(.. + gui="SELECT_m",.. + graphics=scicos_graphics(.. + orig=[298.86371,253.57321],.. + sz=[40,40],.. + flip=%t,.. + theta=0,.. + exprs=["5";"2";"1"],.. + pin=[33;40],.. + pout=34,.. + pein=[43;44],.. + peout=[],.. + gr_i=[],.. + id="",.. + in_implicit=["E";"E"],.. + out_implicit="E"),.. + model=scicos_model(.. + sim=list("selector_m",4),.. + in=[-1;-1],.. + in2=[-2;-2],.. + intyp=[5;5],.. + out=-1,.. + out2=-2,.. + outtyp=5,.. + evtin=[1;1],.. + evtout=[],.. + state=[],.. + dstate=1,.. + odstate=list(),.. + rpar=[],.. + ipar=[],.. + opar=list(),.. + blocktype="c",.. + firing=[],.. + dep_ut=[%t,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m.objs(33)=scicos_link(.. + xx=[282.29299;290.29229],.. + yy=[280.24498;280.23987],.. + id="drawlink",.. + thick=[0,0],.. + ct=[1,1],.. + from=[4,1,0],.. + to=[32,1,1]) + scs_m.objs(34)=scicos_link(.. + xx=[347.43514;357.57328;357.57328],.. + yy=[273.57321;273.57321;280.83282],.. + id="drawlink",.. + thick=[0,0],.. + ct=[1,1],.. + from=[32,1,0],.. + to=[35,1,1]) + scs_m.objs(35)=scicos_block(.. + gui="SPLIT_f",.. + graphics=scicos_graphics(.. + orig=[357.57328,280.83282],.. + sz=[0.3333333,0.3333333],.. + flip=%t,.. + theta=0,.. + exprs=[],.. + pin=34,.. + pout=[36;37],.. + pein=[],.. + peout=[],.. + gr_i=[],.. + id="",.. + in_implicit="E",.. + out_implicit=["E";"E";"E"]),.. + model=scicos_model(.. + sim="lsplit",.. + in=-1,.. + in2=[],.. + intyp=1,.. + out=[-1;-1;-1],.. + out2=[],.. + outtyp=1,.. + evtin=[],.. + evtout=[],.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=[],.. + ipar=[],.. + opar=list(),.. + blocktype="c",.. + firing=[],.. + dep_ut=[%t,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m.objs(36)=scicos_link(.. + xx=[357.57328;357.57328;364.66964],.. + yy=[280.83282;329.46812;329.46812],.. + id="drawlink",.. + thick=[0,0],.. + ct=[1,1],.. + from=[35,1,0],.. + to=[7,1,1]) + scs_m.objs(37)=scicos_link(.. + xx=[357.57328;376.4669],.. + yy=[280.83282;280.83282],.. + id="drawlink",.. + thick=[0,0],.. + ct=[1,1],.. + from=[35,2,0],.. + to=[14,1,1]) + scs_m.objs(38)=scicos_block(.. + gui="SPLIT_f",.. + graphics=scicos_graphics(.. + orig=[140.34523;273.49157],.. + sz=[0.3333333,0.3333333],.. + flip=%t,.. + theta=0,.. + exprs=[],.. + pin=6,.. + pout=[39;40],.. + pein=[],.. + peout=[],.. + gr_i=[],.. + id="",.. + in_implicit="E",.. + out_implicit=["E";"E";"E"]),.. + model=scicos_model(.. + sim="lsplit",.. + in=-1,.. + in2=[],.. + intyp=1,.. + out=[-1;-1;-1],.. + out2=[],.. + outtyp=1,.. + evtin=[],.. + evtout=[],.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=[],.. + ipar=[],.. + opar=list(),.. + blocktype="c",.. + firing=[],.. + dep_ut=[%t,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m.objs(39)=scicos_link(.. + xx=[140.34523;144.31759],.. + yy=[273.49157;273.57832],.. + id="drawlink",.. + thick=[0,0],.. + ct=[1,1],.. + from=[38,1,0],.. + to=[3,2,1]) + scs_m.objs(40)=scicos_link(.. + xx=[140.34523;140.34523;290.29229;290.29229],.. + yy=[273.49157;247.70767;247.70767;266.90654],.. + id="drawlink",.. + thick=[0,0],.. + ct=[1,1],.. + from=[38,2,0],.. + to=[32,2,1]) + scs_m.objs(41)=scicos_block(.. + gui="CLKSPLIT_f",.. + graphics=scicos_graphics(.. + orig=[253.72572;309.29537],.. + sz=[0.3333333,0.3333333],.. + flip=%t,.. + theta=0,.. + exprs=[],.. + pin=[],.. + pout=[],.. + pein=17,.. + peout=[42;43],.. + gr_i=[],.. + id="",.. + in_implicit=[],.. + out_implicit=[]),.. + model=scicos_model(.. + sim="split",.. + in=[],.. + in2=[],.. + intyp=1,.. + out=[],.. + out2=[],.. + outtyp=1,.. + evtin=1,.. + evtout=[1;1],.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=[],.. + ipar=[],.. + opar=list(),.. + blocktype="d",.. + firing=[%f,%f,%f],.. + dep_ut=[%f,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m.objs(42)=scicos_link(.. + xx=[253.72572;253.72156],.. + yy=[309.29537;305.95927],.. + id="drawlink",.. + thick=[0,0],.. + ct=[5,-1],.. + from=[41,1,0],.. + to=[4,1,1]) + scs_m.objs(43)=scicos_link(.. + xx=[253.72572;312.19705;312.19705],.. + yy=[309.29537;309.29537;299.28749],.. + id="drawlink",.. + thick=[0,0],.. + ct=[5,-1],.. + from=[41,2,0],.. + to=[32,1,1]) + scs_m.objs(44)=scicos_link(.. + xx=[279.98293;279.98293;325.53038;325.53038],.. + yy=[372.50232;315.89455;315.89455;299.28749],.. + id="drawlink",.. + thick=[0,0],.. + ct=[5,-1],.. + from=[2,2,0],.. + to=[32,2,1]) + model=scicos_model() + model.sim="csuper" + model.in=[1;1;1] + model.in2=[1;1;1] + model.out=[1;1] + model.out2=[1;1] + model.intyp=[5 1 1] + model.outtyp=[5 5] + model.blocktype="h" + model.firing=%f + model.dep_ut=[%t %f] + model.rpar=scs_m + gr_i=[] + x=standard_define([2 3],model,[],gr_i) + end +endfunction diff --git a/macros/IntegerOp/DLATCH.sci b/macros/IntegerOp/DLATCH.sci new file mode 100644 index 00000000..f0a0fb4e --- /dev/null +++ b/macros/IntegerOp/DLATCH.sci @@ -0,0 +1,534 @@ +// Scicos +// +// Copyright (C) INRIA - METALAU Project <scicos@inria.fr> +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// See the file ../license.txt +// + +function [x,y,typ]=DLATCH(job,arg1,arg2) + x=[];y=[],typ=[] + select job + case "set" then + x=arg1 + case "define" then + scs_m=scicos_diagram(.. + version="scicos4.2",.. + props=scicos_params(.. + wpar=[600,450,0,0,600,450],.. + Title=["DLATCH"],.. + tol=[0.0001,0.000001,1.000E-10,100001,0,0],.. + tf=100000,.. + context=" ",.. + void1=[],.. + options=tlist(["scsopt","3D","Background","Link","ID","Cmap"],list(%t,33),[8,1],[1,5],.. + list([5,1],[4,1]),[0.8,0.8,0.8]),.. + void2=[],.. + void3=[],.. + doc=list())) + scs_m.objs(1)=scicos_block(.. + gui="CONST_m",.. + graphics=scicos_graphics(.. + orig=[109.62561,263.44465],.. + sz=[20;20],.. + flip=%t,.. + theta=0,.. + exprs="int8(0)",.. + pin=[],.. + pout=7,.. + pein=[],.. + peout=[],.. + gr_i=[],.. + id="",.. + in_implicit=[],.. + out_implicit="E"),.. + model=scicos_model(.. + sim=list("cstblk4_m",4),.. + in=[],.. + in2=[],.. + intyp=1,.. + out=1,.. + out2=1,.. + outtyp=5,.. + evtin=[],.. + evtout=[],.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=[],.. + ipar=[],.. + opar=list(int8(0)),.. + blocktype="d",.. + firing=[],.. + dep_ut=[%f,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m.objs(2)=scicos_block(.. + gui="IFTHEL_f",.. + graphics=scicos_graphics(.. + orig=[233.37693,320.30536],.. + sz=[60,60],.. + flip=%t,.. + theta=0,.. + exprs=["0";"1"],.. + pin=13,.. + pout=[],.. + pein=[],.. + peout=[6;0],.. + gr_i=list(.. + ["txt=[''If in>0'';'' '';'' then else''];"; + "xstringb(orig(1),orig(2),txt,sz(1),sz(2),''fill'');"],8),.. + id="",.. + in_implicit="E",.. + out_implicit=[]),.. + model=scicos_model(.. + sim=list("ifthel",-1),.. + in=1,.. + in2=1,.. + intyp=-1,.. + out=[],.. + out2=[],.. + outtyp=1,.. + evtin=[],.. + evtout=[1;1],.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=[],.. + ipar=[],.. + opar=list(),.. + blocktype="l",.. + firing=[-1,-1],.. + dep_ut=[%t,%f],.. + label="",.. + nzcross=1,.. + nmode=1,.. + equations=list()),.. + doc=list()) + scs_m.objs(3)=scicos_block(.. + gui="LOGICAL_OP",.. + graphics=scicos_graphics(.. + orig=[152.88902,260.24498],.. + sz=[60,40],.. + flip=%t,.. + theta=0,.. + exprs=["2";"1";"5";"0"],.. + pin=[15;7],.. + pout=5,.. + pein=[],.. + peout=[],.. + gr_i=list(.. + "xstringb(orig(1),orig(2),[''Logical Op '';OPER],sz(1),sz(2),''fill'');",8),.. + id="",.. + in_implicit=["E";"E"],.. + out_implicit="E"),.. + model=scicos_model(.. + sim=list("logicalop_i8",4),.. + in=[-1;-1],.. + in2=[-2;-2],.. + intyp=[5;5],.. + out=-1,.. + out2=-2,.. + outtyp=5,.. + evtin=[],.. + evtout=[],.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=[],.. + ipar=[1;0],.. + opar=list(),.. + blocktype="c",.. + firing=[],.. + dep_ut=[%t,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m.objs(4)=scicos_block(.. + gui="SAMPHOLD_m",.. + graphics=scicos_graphics(.. + orig=[233.72156,260.24498],.. + sz=[40,40],.. + flip=%t,.. + theta=0,.. + exprs="5",.. + pin=5,.. + pout=9,.. + pein=6,.. + peout=[],.. + gr_i=list("xstringb(orig(1),orig(2),''S/H'',sz(1),sz(2),''fill'')",8),.. + id="",.. + in_implicit="E",.. + out_implicit="E"),.. + model=scicos_model(.. + sim=list("samphold4_m",4),.. + in=-1,.. + in2=-2,.. + intyp=5,.. + out=-1,.. + out2=-2,.. + outtyp=5,.. + evtin=1,.. + evtout=[],.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=[],.. + ipar=[],.. + opar=list(),.. + blocktype="d",.. + firing=[],.. + dep_ut=[%t,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m.objs(5)=scicos_link(.. + xx=[221.46044;225.15013],.. + yy=[280.24498;280.24498],.. + id="drawlink",.. + thick=[0,0],.. + ct=[1,1],.. + from=[3,1,0],.. + to=[4,1,1]) + scs_m.objs(6)=scicos_link(.. + xx=[253.37693;253.72156],.. + yy=[314.59108;305.95927],.. + id="drawlink",.. + thick=[0,0],.. + ct=[5,-1],.. + from=[2,1,0],.. + to=[4,1,1]) + scs_m.objs(7)=scicos_link(.. + xx=[138.19704;144.31759],.. + yy=[273.44465;273.57832],.. + id="drawlink",.. + thick=[0,0],.. + ct=[1,1],.. + from=[1,1,0],.. + to=[3,2,1]) + scs_m.objs(8)=scicos_block(.. + gui="LOGICAL_OP",.. + graphics=scicos_graphics(.. + orig=[317.46698,309.46812],.. + sz=[60,40],.. + flip=%t,.. + theta=0,.. + exprs=["1";"5";"5";"0"],.. + pin=11,.. + pout=17,.. + pein=[],.. + peout=[],.. + gr_i=list(.. + "xstringb(orig(1),orig(2),[''Logical Op '';OPER],sz(1),sz(2),''fill'');",8),.. + id="",.. + in_implicit="E",.. + out_implicit="E"),.. + model=scicos_model(.. + sim=list("logicalop_i8",4),.. + in=-1,.. + in2=-2,.. + intyp=5,.. + out=-1,.. + out2=-2,.. + outtyp=5,.. + evtin=[],.. + evtout=[],.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=[],.. + ipar=[5;0],.. + opar=list(),.. + blocktype="c",.. + firing=[],.. + dep_ut=[%t,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m.objs(9)=scicos_link(.. + xx=[282.29299;305.09603;305.09603],.. + yy=[280.24498;280.52797;280.83282],.. + id="drawlink",.. + thick=[0,0],.. + ct=[1,1],.. + from=[4,1,0],.. + to=[10,1,1]) + scs_m.objs(10)=scicos_block(.. + gui="SPLIT_f",.. + graphics=scicos_graphics(.. + orig=[305.09603,280.83282],.. + sz=[0.3333333,0.3333333],.. + flip=%t,.. + theta=0,.. + exprs=[],.. + pin=9,.. + pout=[11;19],.. + pein=[],.. + peout=[],.. + gr_i=list([],8),.. + id="",.. + in_implicit="E",.. + out_implicit=["E";"E";"E"]),.. + model=scicos_model(.. + sim="lsplit",.. + in=-1,.. + in2=[],.. + intyp=1,.. + out=[-1;-1;-1],.. + out2=[],.. + outtyp=1,.. + evtin=[],.. + evtout=[],.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=[],.. + ipar=[],.. + opar=list(),.. + blocktype="c",.. + firing=[],.. + dep_ut=[%t,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m.objs(11)=scicos_link(.. + xx=[305.09603;305.09603;308.89555],.. + yy=[280.83282;329.46812;329.46812],.. + id="drawlink",.. + thick=[0,0],.. + ct=[1,1],.. + from=[10,1,0],.. + to=[8,1,1]) + scs_m.objs(12)=scicos_block(.. + gui="IN_f",.. + graphics=scicos_graphics(.. + orig=[184.8055,340.30536],.. + sz=[20,20],.. + flip=%t,.. + theta=0,.. + exprs="2",.. + pin=[],.. + pout=13,.. + pein=[],.. + peout=[],.. + gr_i=list(" ",8),.. + id="",.. + in_implicit=[],.. + out_implicit="E"),.. + model=scicos_model(.. + sim="input",.. + in=[],.. + in2=[],.. + intyp=1,.. + out=-1,.. + out2=[],.. + outtyp=-1,.. + evtin=[],.. + evtout=[],.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=[],.. + ipar=2,.. + opar=list(),.. + blocktype="c",.. + firing=[],.. + dep_ut=[%f,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m.objs(13)=scicos_link(.. + xx=[204.8055;224.8055],.. + yy=[350.30536;350.30536],.. + id="drawlink",.. + thick=[0,0],.. + ct=[1,1],.. + from=[12,1,0],.. + to=[2,1,1]) + scs_m.objs(14)=scicos_block(.. + gui="IN_f",.. + graphics=scicos_graphics(.. + orig=[104.31759,276.91165],.. + sz=[20,20],.. + flip=%t,.. + theta=0,.. + exprs="1",.. + pin=[],.. + pout=15,.. + pein=[],.. + peout=[],.. + gr_i=list(" ",8),.. + id="",.. + in_implicit=[],.. + out_implicit="E"),.. + model=scicos_model(.. + sim="input",.. + in=[],.. + in2=[],.. + intyp=1,.. + out=-1,.. + out2=[],.. + outtyp=-1,.. + evtin=[],.. + evtout=[],.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=[],.. + ipar=1,.. + opar=list(),.. + blocktype="c",.. + firing=[],.. + dep_ut=[%f,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m.objs(15)=scicos_link(.. + xx=[124.31759;144.31759],.. + yy=[286.91165;286.91165],.. + id="drawlink",.. + thick=[0,0],.. + ct=[1,1],.. + from=[14,1,0],.. + to=[3,1,1]) + scs_m.objs(16)=scicos_block(.. + gui="OUT_f",.. + graphics=scicos_graphics(.. + orig=[406.03841,319.46812],.. + sz=[20,20],.. + flip=%t,.. + theta=0,.. + exprs="2",.. + pin=17,.. + pout=[],.. + pein=[],.. + peout=[],.. + gr_i=list(" ",8),.. + id="",.. + in_implicit="E",.. + out_implicit=[]),.. + model=scicos_model(.. + sim="output",.. + in=-1,.. + in2=[],.. + intyp=-1,.. + out=[],.. + out2=[],.. + outtyp=1,.. + evtin=[],.. + evtout=[],.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=[],.. + ipar=2,.. + opar=list(),.. + blocktype="c",.. + firing=[],.. + dep_ut=[%f,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m.objs(17)=scicos_link(.. + xx=[386.03841;406.03841],.. + yy=[329.46812;329.46812],.. + id="drawlink",.. + thick=[0,0],.. + ct=[1,1],.. + from=[8,1,0],.. + to=[16,1,1]) + scs_m.objs(18)=scicos_block(.. + gui="OUT_f",.. + graphics=scicos_graphics(.. + orig=[325.09603,270.83282],.. + sz=[20,20],.. + flip=%t,.. + theta=0,.. + exprs="1",.. + pin=19,.. + pout=[],.. + pein=[],.. + peout=[],.. + gr_i=list(" ",8),.. + id="",.. + in_implicit="E",.. + out_implicit=[]),.. + model=scicos_model(.. + sim="output",.. + in=-1,.. + in2=[],.. + intyp=-1,.. + out=[],.. + out2=[],.. + outtyp=1,.. + evtin=[],.. + evtout=[],.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=[],.. + ipar=1,.. + opar=list(),.. + blocktype="c",.. + firing=[],.. + dep_ut=[%f,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m.objs(19)=scicos_link(.. + xx=[305.09603;325.09603],.. + yy=[280.83282;280.83282],.. + id="drawlink",.. + thick=[0,0],.. + ct=[1,1],.. + from=[10,2,0],.. + to=[18,1,1]) + + model=scicos_model() + model.sim="csuper" + model.in=[1;1] + model.in2=[1;1] + model.out=[1;1] + model.out2=[1;1] + model.intyp=[5 -1] + model.outtyp=[5 5] + model.blocktype="h" + model.firing=%f + model.dep_ut=[%t %f] + model.rpar=scs_m + gr_i=[] + x=standard_define([2 3],model,[],gr_i) + end +endfunction diff --git a/macros/IntegerOp/EXTRACTBITS.sci b/macros/IntegerOp/EXTRACTBITS.sci new file mode 100644 index 00000000..a0f1494e --- /dev/null +++ b/macros/IntegerOp/EXTRACTBITS.sci @@ -0,0 +1,275 @@ +// Xcos +// +// Copyright (C) INRIA - METALAU Project <scicos@inria.fr> +// Copyright 2011 - Bernard DUJARDIN <bernard.dujardin@contrib.scilab.org> +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// See the file ../license.txt +// + +function [x,y,typ]=EXTRACTBITS(job,arg1,arg2) + x=[]; + y=[]; + typ=[]; + select job + case "set" then + x=arg1; + graphics=arg1.graphics;exprs=graphics.exprs + model=arg1.model; + while %t do + [ok,Datatype,rule,bit,scal,exprs]=scicos_getvalue( .. + [msprintf(gettext("Set %s block parameters"),"EXTRACTBITS");" "; gettext("Bits Extraction");" "; .. + gettext(" - Bits to Extract:"); .. + gettext(" 1 Upper Half"); gettext(" 2 Lower Half"); .. + gettext(" 3 Range from MSB"); gettext(" 4 Range to LSB"); .. + gettext(" 5 Range of Bits"); gettext(" - Number of Bits or Index of bit : Index 0 is LSB"); .. + gettext(" If ''Bits to Extract'' is set to ''Range of bits'': [Start, End]");" "],.. + [msprintf(gettext("Data Type %s"), "(3:int32, 4:int16, 5:int8, ...)"); gettext("Bits to extract"); .. + gettext("Number of Bits or Index of Bit"); gettext("Treat Bit Field as an Integer (0:No, 1:Yes)")],.. + list("vec",1,"vec",1,"vec",-1,"vec",1), exprs); + + if ~ok then + break, + end + bitstr = strcat(string(bit(:))," ") + if (rule < 1) | (rule > 5) then + block_parameter_error(msprintf(gettext("Wrong value for ''%s'' parameter: %d."), gettext("Bits to Extract"), rule), .. + msprintf(gettext("Must be in the interval %s."), "[1, 5]")); + ok = %f; + elseif scal < 0 | scal > 1 then + block_parameter_error(msprintf(gettext("Wrong value for ''%s'' parameter: %d."), gettext("Treat Bit Field as an Integer"), scal), .. + msprintf(gettext("Must be in the interval %s."), "[0, 1]")); + ok = %f + else + + in=[model.in model.in2]; + bit=int(bit); + rule=int(rule); + + if (rule==3)|(rule==4) then + if (size(bit,"*") ~= 1) then + block_parameter_error(msprintf(gettext("Wrong size for ''%s'' parameter: %s."), gettext("Number of Bits or Index of Bit"), bitstr), .. + gettext("Must be a single value.")); + ok=%f; + else + numb=bit; + end + elseif (rule==5) + if (size(bit,"*") ~= 2) then + block_parameter_error(msprintf(gettext("Wrong size for ''%s'' parameter: %s."), gettext("Number of Bits or Index of Bit"), bitstr), .. + gettext("Must have this form: [Start, End].")); + ok=%f; + elseif bit(1) > bit(2) then + block_parameter_error(msprintf(gettext("Wrong values for ''%s'' parameter: %s."), gettext("Number of Bits or Index of Bit"), bitstr), .. + msprintf(gettext("''Start'' must be less than ''End''."))); + ok=%f; + else + numb=bit(2)-bit(1); + end ; + else + bit=0; + numb=[] + end + end + + if ok then + if (Datatype==3 | Datatype==6) then + + if or(bit(:) > 31) | or(bit(:) < 0) then + block_parameter_error(msprintf(gettext("Wrong value for ''%s'' parameter: %s."), gettext("Number of Bits or Index of Bit"), bitstr), .. + msprintf(gettext("Indexes must be in the interval %s."), "[0, 31]")); + ok=%f; + end + select rule + case 1 then + select scal + case 0 then + model.sim=list("extract_bit_32_UH0",4) + case 1 then + select Datatype + case 3 then + model.sim=list("extract_bit_32_UH1",4) + case 6 then + model.sim=list("extract_bit_u32_UH1",4) + end + end + case 2 then + model.sim=list("extract_bit_32_LH",4) + case 3 then + select scal + case 0 then + model.sim=list("extract_bit_32_MSB0",4) + case 1 then + select Datatype + case 3 then + model.sim=list("extract_bit_32_MSB1",4) + case 6 then + model.sim=list("extract_bit_u32_MSB1",4) + end + end + case 4 then + model.sim=list("extract_bit_32_LSB",4) + case 5 then + select scal + case 0 then + model.sim=list("extract_bit_32_RB0",4) + case 1 then + select Datatype + case 3 then + model.sim=list("extract_bit_32_RB1",4) + case 6 then + model.sim=list("extract_bit_u32_RB1",4) + end + end + end + elseif (Datatype==4 | Datatype==7) then + if or(bit(:) > 15) | or(bit(:) < 0) then + block_parameter_error(msprintf(gettext("Wrong value for ''%s'' parameter: %s."), gettext("Number of Bits or Index of Bit"), bitstr), .. + msprintf(gettext("Indexes must be in the interval %s."), "[0, 15]")); + ok=%f; + end + select rule + case 1 then + select scal + case 0 then + model.sim=list("extract_bit_16_UH0",4) + case 1 then + select Datatype + case 4 then + model.sim=list("extract_bit_16_UH1",4) + case 7 then + model.sim=list("extract_bit_u16_UH1",4) + end + end + case 2 then + model.sim=list("extract_bit_16_LH",4) + case 3 then + select scal + case 0 then + model.sim=list("extract_bit_16_MSB0",4) + case 1 then + select Datatype + case 4 then + model.sim=list("extract_bit_16_MSB1",4) + case 7 then + model.sim=list("extract_bit_u16_MSB1",4) + end + end + case 4 then + model.sim=list("extract_bit_16_LSB",4) + case 5 then + select scal + case 0 then + model.sim=list("extract_bit_16_RB0",4) + case 1 then + select Datatype + case 4 then + model.sim=list("extract_bit_16_RB1",4) + case 7 then + model.sim=list("extract_bit_u16_RB1",4) + end + end + end + elseif (Datatype == 5 | Datatype == 8) then + if or(bit(:) > 7) | or(bit(:) < 0) then + block_parameter_error(msprintf(gettext("Wrong value for ''%s'' parameter: %s."), gettext("Number of Bits or Index of Bit"), bitstr), .. + msprintf(gettext("Indexes must be in the interval %s."), "[0, 7]")); + ok=%f; + end + select rule + case 1 then + select scal + case 0 then + model.sim=list("extract_bit_8_UH0",4) + case 1 then + select Datatype + case 5 then + model.sim=list("extract_bit_8_UH1",4) + case 8 then + model.sim=list("extract_bit_u8_UH1",4) + end + end + case 2 then + model.sim=list("extract_bit_8_LH",4) + case 3 then + select scal + case 0 then + model.sim=list("extract_bit_8_MSB0",4) + case 1 then + select Datatype + case 5 then + model.sim=list("extract_bit_8_MSB1",4) + case 8 then + model.sim=list("extract_bit_u8_MSB1",4) + end + end + case 4 then + model.sim=list("extract_bit_8_LSB",4) + case 5 then + select scal + case 0 then + model.sim=list("extract_bit_8_RB0",4) + case 1 then + select Datatype + case 5 then + model.sim=list("extract_bit_8_RB1",4) + case 8 then + model.sim=list("extract_bit_u8_RB1",4) + end + end + end + else + block_parameter_error(msprintf(gettext("Wrong value for ''%s'' parameter: %d."), gettext("Data Type"), Datatype), .. + msprintf(gettext("Must be in the interval %s."), "[3, 8]")); + ok=%f; + end + end + + if ok then + it=Datatype + ot=Datatype + out=[1 1] + [model,graphics,ok]=set_io(model,graphics,list(in,it),list(out,ot),[],[]) + end + if ok then + graphics.exprs=exprs; + model.ipar=[int(bit(:));int(numb(:))]; + x.graphics=graphics; + x.model=model; + break + end + end + + case "define" then + numb=[]; + model=scicos_model() + model.sim=list("extract_bit_32_UH0",4) + model.in=1 + model.in2=1 + model.out=1 + model.out2=1; + model.intyp=3 + model.outtyp=3 + model.ipar=[0,numb] + model.blocktype="c" + model.dep_ut=[%t %f] + + exprs=[sci2exp(3);sci2exp(1);sci2exp(0);sci2exp(0)] + gr_i=[] + x=standard_define([4 2],model,exprs,gr_i) + + end +endfunction diff --git a/macros/IntegerOp/INTMUL.sci b/macros/IntegerOp/INTMUL.sci new file mode 100644 index 00000000..e5772467 --- /dev/null +++ b/macros/IntegerOp/INTMUL.sci @@ -0,0 +1,137 @@ +// Scicos +// +// Copyright (C) INRIA - METALAU Project <scicos@inria.fr> +// Copyright 2011 - Bernard DUJARDIN <bernard.dujardin@contrib.scilab.org> +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// See the file ../license.txt +// + +function [x,y,typ]=INTMUL(job,arg1,arg2) + x=[]; + y=[]; + typ=[]; + select job + case "set" then + x=arg1; + graphics=arg1.graphics + model=arg1.model + exprs=graphics.exprs + while %t do + [ok,Datatype,np,exprs]=scicos_getvalue( .. + [msprintf(gettext("Set %s block parameters"),"INTMUL"); " "; gettext("Integer matrix multiplication");" ";],.. + [msprintf(gettext("Data Type %s"), "(3:int32, 4:int16, 5:int8, ...)"); gettext("Do on Overflow (0:Nothing, 1:Saturate, 2:Error)")],.. + list("vec",1,"vec",1), exprs) + if ~ok then + break, + end + + it=Datatype*ones(1,2); + ot=Datatype; + if (np~=0 & np~=1 & np~=2) then + block_parameter_error(msprintf( gettext("Wrong value for ''%s'' parameter: %d."), gettext("Do on Overflow"), np), .. + msprintf( gettext("Must be in the interval %s."), "[0, 2]")); + ok=%f; + elseif Datatype==3 then + if np==0 then + model.sim=list("matmul_i32n",4) + elseif np==1 then + model.sim=list("matmul_i32s",4) + else + model.sim=list("matmul_i32e",4) + end + elseif Datatype==4 then + if np==0 then + model.sim=list("matmul_i16n",4) + elseif np==1 then + model.sim=list("matmul_i16s",4) + else + model.sim=list("matmul_i16e",4) + end + elseif Datatype==5 then + if np==0 then + model.sim=list("matmul_i8n",4) + elseif np==1 then + model.sim=list("matmul_i8s",4) + else + model.sim=list("matmul_i8e",4) + end + elseif Datatype==6 then + if np==0 then + model.sim=list("matmul_ui32n",4) + elseif np==1 then + model.sim=list("matmul_ui32s",4) + else + model.sim=list("matmul_ui32e",4) + end + elseif Datatype==7 then + if np==0 then + model.sim=list("matmul_ui16n",4) + elseif np==1 then + model.sim=list("matmul_ui16s",4) + else + model.sim=list("matmul_ui16e",4) + end + elseif Datatype==8 then + if np==0 then + model.sim=list("matmul_ui8n",4) + elseif np==1 then + model.sim=list("matmul_ui8s",4) + else + model.sim=list("matmul_ui8e",4) + end + else + block_parameter_error(msprintf(gettext("Wrong value for ''%s'' parameter: %d."), gettext("Data Type"), ot), .. + msprintf(gettext("Must be in the interval %s."), "[3, 8]")); + ok=%f; + + end + in=[model.in model.in2] + out=[model.out model.out2] + if ok then + [model,graphics,ok]=set_io(model,graphics,... + list(in,it),... + list(out,ot),[],[]) + end + if ok then + model.ipar=np + graphics.exprs=exprs + x.graphics=graphics; + x.model=model + break + end + end + case "define" then + sgn=0 + model=scicos_model() + model.sim=list("matmul_i32",4) + model.in=[-1;-2] + model.out=-1 + model.in2=[-2;-3] + model.out2=-3 + model.intyp=[3 3] + model.outtyp=3 + model.rpar=[] + model.ipar=sgn + model.blocktype="c" + model.dep_ut=[%t %f] + + + exprs=[sci2exp(3);sci2exp(0)] + gr_i=[] + x=standard_define([2 2],model, exprs,gr_i) + end +endfunction diff --git a/macros/IntegerOp/JKFLIPFLOP.sci b/macros/IntegerOp/JKFLIPFLOP.sci new file mode 100644 index 00000000..67405172 --- /dev/null +++ b/macros/IntegerOp/JKFLIPFLOP.sci @@ -0,0 +1,833 @@ +// Xcos +// +// Copyright (C) INRIA - METALAU Project <scicos@inria.fr> +// Copyright 2011 - Bernard DUJARDIN <bernard.dujardin@contrib.scilab.org> +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// See the file ../license.txt +// + +function [x,y,typ] = JKFLIPFLOP(job,arg1,arg2) + x=[]; + y=[]; + typ=[]; + select job + case "set" then + // look for the 1/z block + for i=1:length(arg1.model.rpar.objs) do + o = arg1.model.rpar.objs(i); + if typeof(o) == "Block" & o.gui == "DOLLAR_m" then + path = i; + break; + end + end + // if exprs==[] then exprs=sci2exp(int8(0));end + newpar=list() + xx=arg1.model.rpar.objs(path)// get the 1/z block + exprs=xx.graphics.exprs(1) + model=xx.model; + init_old= model.odstate(1) + while %t do + [ok,init,exprs0]=scicos_getvalue( .. + [msprintf(gettext("Set %s block parameters"), "JKFLIPFLOP" ); " ";gettext("JK flip-flop");" "; .. + gettext("The ''Initial Value'' must be 0 or 1 of type int8"); .. + gettext(" - Negative values are considered as int8(0)"); gettext(" - Positive values are considered as int8(1)"); " "], .. + gettext("Initial Value"), .. + list("vec",1), exprs); + + if ~ok then + break, + end + if init<=0 then + init=int8(0); + elseif init >0 then + init=int8(1); + end + if ok then + xx.graphics.exprs(1)=exprs0 + model.odstate(1)=init + xx.model=model + arg1.model.rpar.objs(path)=xx// Update + break + end + end + needcompile=0 + if init_old<>init then + // parameter changed + newpar(size(newpar)+1)=1// Notify modification + needcompile=2 + end + x=arg1 + y=needcompile + typ=newpar + case "define" then + scs_m=scicos_diagram(.. + version="scicos4.2",.. + props=scicos_params(.. + wpar=[600,450,0,0,600,450],.. + Title=["JKFLIPFLOP"],.. + tol=[0.0001;0.000001;1.000E-10;100001;0;0;0],.. + tf=60,.. + context=" ",.. + void1=[],.. + options=tlist(["scsopt","3D","Background","Link","ID","Cmap"],list(%t,33),[8,1],[1,5],.. + list([5,1],[4,1]),[0.8,0.8,0.8]),.. + void2=[],.. + void3=[],.. + doc=list())) + scs_m.objs(1)=scicos_block(.. + gui="DOLLAR_m",.. + graphics=scicos_graphics(.. + orig=[299.96961,261.584],.. + sz=[40,40],.. + flip=%f,.. + theta=0,.. + exprs=["int8(0)";"1"],.. + pin=7,.. + pout=5,.. + pein=[],.. + peout=[],.. + gr_i=[],.. + id="",.. + in_implicit="E",.. + out_implicit="E"),.. + model=scicos_model(.. + sim=list("dollar4_m",4),.. + in=1,.. + in2=1,.. + intyp=5,.. + out=1,.. + out2=1,.. + outtyp=5,.. + evtin=[],.. + evtout=[],.. + state=[],.. + dstate=[],.. + odstate=list(int8(0)),.. + rpar=[],.. + ipar=[],.. + opar=list(),.. + blocktype="d",.. + firing=[],.. + dep_ut=[%f,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m_1=scicos_diagram(.. + version="scicos4.2",.. + props=scicos_params(.. + wpar=[600,450,0,0,600,450],.. + Title=["EDGE_TRIGGER","./"],.. + tol=[0.0001;0.000001;1.000E-10;100001;0;0;0],.. + tf=30,.. + context=" ",.. + void1=[],.. + options=tlist(["scsopt","3D","Background","Link","ID","Cmap"],list(%t,33),[8,1],[1,5],.. + list([5,1],[4,1]),[0.8,0.8,0.8]),.. + void2=[],.. + void3=[],.. + doc=list())) + scs_m_1.objs(1)=scicos_block(.. + gui="EDGETRIGGER",.. + graphics=scicos_graphics(.. + orig=[288.58631,257.1131],.. + sz=[60,40],.. + flip=%t,.. + theta=0,.. + exprs="-1",.. + pin=5,.. + pout=3,.. + pein=[],.. + peout=[],.. + gr_i=[],.. + id="",.. + in_implicit="E",.. + out_implicit="E"),.. + model=scicos_model(.. + sim=list("edgetrig",4),.. + in=1,.. + in2=[],.. + intyp=1,.. + out=1,.. + out2=[],.. + outtyp=1,.. + evtin=[],.. + evtout=[],.. + state=[],.. + dstate=0,.. + odstate=list(),.. + rpar=[],.. + ipar=-1,.. + opar=list(),.. + blocktype="c",.. + firing=[],.. + dep_ut=[%t,%f],.. + label="",.. + nzcross=1,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m_1.objs(2)=scicos_block(.. + gui="IFTHEL_f",.. + graphics=scicos_graphics(.. + orig=[388.28869,247.1131],.. + sz=[60,60],.. + flip=%t,.. + theta=0,.. + exprs=["0";"0"],.. + pin=3,.. + pout=[],.. + pein=[],.. + peout=[7;0],.. + gr_i=[],.. + id="",.. + in_implicit="E",.. + out_implicit=[]),.. + model=scicos_model(.. + sim=list("ifthel",-1),.. + in=1,.. + in2=[],.. + intyp=1,.. + out=[],.. + out2=1,.. + outtyp=[],.. + evtin=[],.. + evtout=[1;1],.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=[],.. + ipar=[],.. + opar=list(),.. + blocktype="l",.. + firing=[-1,-1],.. + dep_ut=[%t,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m_1.objs(3)=scicos_link(.. + xx=[357.15774;362.99107;379.71726],.. + yy=[277.1131;277.1131;277.1131],.. + id="drawlink",.. + thick=[0,0],.. + ct=[1,1],.. + from=[1,1,0],.. + to=[2,1,1]) + scs_m_1.objs(4)=scicos_block(.. + gui="IN_f",.. + graphics=scicos_graphics(.. + orig=[240.01488,267.1131],.. + sz=[20,20],.. + flip=%t,.. + theta=0,.. + exprs="1",.. + pin=[],.. + pout=5,.. + pein=[],.. + peout=[],.. + gr_i=[],.. + id="",.. + in_implicit=[],.. + out_implicit="E"),.. + model=scicos_model(.. + sim="input",.. + in=[],.. + in2=[],.. + intyp=1,.. + out=-1,.. + out2=[],.. + outtyp=1,.. + evtin=[],.. + evtout=[],.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=[],.. + ipar=1,.. + opar=list(),.. + blocktype="c",.. + firing=[],.. + dep_ut=[%f,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m_1.objs(5)=scicos_link(.. + xx=[260.01488;280.01488],.. + yy=[277.1131;277.1131],.. + id="drawlink",.. + thick=[0,0],.. + ct=[1,1],.. + from=[4,1,0],.. + to=[1,1,1]) + scs_m_1.objs(6)=scicos_block(.. + gui="CLKOUTV_f",.. + graphics=scicos_graphics(.. + orig=[398.28869,181.39881],.. + sz=[20,30],.. + flip=%t,.. + theta=0,.. + exprs="1",.. + pin=[],.. + pout=[],.. + pein=7,.. + peout=[],.. + gr_i=[],.. + id="",.. + in_implicit=[],.. + out_implicit=[]),.. + model=scicos_model(.. + sim="output",.. + in=[],.. + in2=[],.. + intyp=1,.. + out=[],.. + out2=[],.. + outtyp=1,.. + evtin=1,.. + evtout=[],.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=[],.. + ipar=1,.. + opar=list(),.. + blocktype="d",.. + firing=[],.. + dep_ut=[%f,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m_1.objs(7)=scicos_link(.. + xx=[408.28869;408.28869],.. + yy=[241.39881;211.39881],.. + id="drawlink",.. + thick=[0,0],.. + ct=[5,-1],.. + from=[2,1,0],.. + to=[6,1,1]) + scs_m.objs(2)=scicos_block(.. + gui="EDGE_TRIGGER",.. + graphics=scicos_graphics(.. + orig=[292.52452,323.54888],.. + sz=[60,40],.. + flip=%t,.. + theta=0,.. + exprs=[],.. + pin=14,.. + pout=[],.. + pein=[],.. + peout=8,.. + gr_i=[],.. + id="",.. + in_implicit="E",.. + out_implicit=[]),.. + model=scicos_model(.. + sim="csuper",.. + in=-1,.. + in2=[],.. + intyp=1,.. + out=[],.. + out2=[],.. + outtyp=1,.. + evtin=[],.. + evtout=1,.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=scs_m_1,.. + ipar=[],.. + opar=list(),.. + blocktype="h",.. + firing=[],.. + dep_ut=[%f,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m.objs(3)=scicos_block(.. + gui="LOGIC",.. + graphics=scicos_graphics(.. + orig=[302.79613,202.52782],.. + sz=[40,40],.. + flip=%t,.. + theta=0,.. + exprs=["[0;1;1;1;0;0;1;0]";"0"],.. + pin=[5;16;18],.. + pout=4,.. + pein=8,.. + peout=[],.. + gr_i=[],.. + id="",.. + in_implicit=["E";"E";"E"],.. + out_implicit="E"),.. + model=scicos_model(.. + sim=list("logic",4),.. + in=[1;1;1],.. + in2=[1;1;1],.. + intyp=[5;5;5],.. + out=1,.. + out2=1,.. + outtyp=5,.. + evtin=1,.. + evtout=[],.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=[],.. + ipar=[],.. + opar=list(int8([0;1;1;1;0;0;1;0])),.. + blocktype="c",.. + firing=%f,.. + dep_ut=[%t,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m.objs(4)=scicos_link(.. + xx=[351.36756;368.82793;368.82793],.. + yy=[222.52782;222.52782;223.06473],.. + id="drawlink",.. + thick=[0,0],.. + ct=[1,1],.. + from=[3,1,0],.. + to=[10,1,1]) + scs_m.objs(5)=scicos_link(.. + xx=[291.39818;274.18235;274.18235;294.2247],.. + yy=[281.584;281.584;232.52782;232.52782],.. + id="drawlink",.. + thick=[0,0],.. + ct=[1,1],.. + from=[1,1,0],.. + to=[3,1,1]) + scs_m.objs(6)=scicos_block(.. + gui="SPLIT_f",.. + graphics=scicos_graphics(.. + orig=[368.82793,243.45067],.. + sz=[0.3333333,0.3333333],.. + flip=%t,.. + theta=0,.. + exprs=[],.. + pin=11,.. + pout=[7;20],.. + pein=[],.. + peout=[],.. + gr_i=[],.. + id="",.. + in_implicit="E",.. + out_implicit=["E";"E";"E"]),.. + model=scicos_model(.. + sim="lsplit",.. + in=-1,.. + in2=[],.. + intyp=1,.. + out=[-1;-1;-1],.. + out2=[],.. + outtyp=1,.. + evtin=[],.. + evtout=[],.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=[],.. + ipar=[],.. + opar=list(),.. + blocktype="c",.. + firing=[],.. + dep_ut=[%t,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m.objs(7)=scicos_link(.. + xx=[368.82793;368.82793;345.68389],.. + yy=[243.45067;281.584;281.584],.. + id="drawlink",.. + thick=[0,0],.. + ct=[1,1],.. + from=[6,1,0],.. + to=[1,1,1]) + scs_m.objs(8)=scicos_link(.. + xx=[322.52452;374.69743;374.69743;322.79613],.. + yy=[317.8346;317.8346;248.24211;248.24211],.. + id="drawlink",.. + thick=[0,0],.. + ct=[5,-1],.. + from=[2,1,0],.. + to=[3,1,1]) + scs_m.objs(9)=scicos_block(.. + gui="LOGICAL_OP",.. + graphics=scicos_graphics(.. + orig=[377.63217,159.25363],.. + sz=[60,40],.. + flip=%t,.. + theta=0,.. + exprs=["1";"5";"5";"0"],.. + pin=12,.. + pout=22,.. + pein=[],.. + peout=[],.. + gr_i=[],.. + id="",.. + in_implicit="E",.. + out_implicit="E"),.. + model=scicos_model(.. + sim=list("logicalop_i8",4),.. + in=-1,.. + in2=-2,.. + intyp=5,.. + out=-1,.. + out2=-2,.. + outtyp=5,.. + evtin=[],.. + evtout=[],.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=[],.. + ipar=[5;0],.. + opar=list(),.. + blocktype="c",.. + firing=[],.. + dep_ut=[%t,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m.objs(10)=scicos_block(.. + gui="SPLIT_f",.. + graphics=scicos_graphics(.. + orig=[368.82793;223.06473],.. + sz=[0.3333333,0.3333333],.. + flip=%t,.. + theta=0,.. + exprs=[],.. + pin=4,.. + pout=[11;12],.. + pein=[],.. + peout=[],.. + gr_i=[],.. + id="",.. + in_implicit="E",.. + out_implicit=["E";"E";"E"]),.. + model=scicos_model(.. + sim="lsplit",.. + in=-1,.. + in2=[],.. + intyp=1,.. + out=[-1;-1;-1],.. + out2=[],.. + outtyp=1,.. + evtin=[],.. + evtout=[],.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=[],.. + ipar=[],.. + opar=list(),.. + blocktype="c",.. + firing=[],.. + dep_ut=[%t,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m.objs(11)=scicos_link(.. + xx=[368.82793;368.82793],.. + yy=[223.06473;243.45067],.. + id="drawlink",.. + thick=[0,0],.. + ct=[1,1],.. + from=[10,1,0],.. + to=[6,1,1]) + scs_m.objs(12)=scicos_link(.. + xx=[368.82793;368.82793;369.06074],.. + yy=[223.06473;177.7867;179.25363],.. + id="drawlink",.. + thick=[0,0],.. + ct=[1,1],.. + from=[10,2,0],.. + to=[9,1,1]) + scs_m.objs(13)=scicos_block(.. + gui="IN_f",.. + graphics=scicos_graphics(.. + orig=[243.95309,333.54888],.. + sz=[20,20],.. + flip=%t,.. + theta=0,.. + exprs="2",.. + pin=[],.. + pout=14,.. + pein=[],.. + peout=[],.. + gr_i=[],.. + id="",.. + in_implicit=[],.. + out_implicit="E"),.. + model=scicos_model(.. + sim="input",.. + in=[],.. + in2=[],.. + intyp=1,.. + out=-1,.. + out2=[],.. + outtyp=-1,.. + evtin=[],.. + evtout=[],.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=[],.. + ipar=2,.. + opar=list(),.. + blocktype="c",.. + firing=[],.. + dep_ut=[%f,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m.objs(14)=scicos_link(.. + xx=[263.95309;283.95309],.. + yy=[343.54888;343.54888],.. + id="drawlink",.. + thick=[0,0],.. + ct=[1,1],.. + from=[13,1,0],.. + to=[2,1,1]) + scs_m.objs(15)=scicos_block(.. + gui="IN_f",.. + graphics=scicos_graphics(.. + orig=[254.2247,212.52782],.. + sz=[20,20],.. + flip=%t,.. + theta=0,.. + exprs="1",.. + pin=[],.. + pout=16,.. + pein=[],.. + peout=[],.. + gr_i=[],.. + id="",.. + in_implicit=[],.. + out_implicit="E"),.. + model=scicos_model(.. + sim="input",.. + in=[],.. + in2=[],.. + intyp=1,.. + out=-1,.. + out2=[],.. + outtyp=-1,.. + evtin=[],.. + evtout=[],.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=[],.. + ipar=1,.. + opar=list(),.. + blocktype="c",.. + firing=[],.. + dep_ut=[%f,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m.objs(16)=scicos_link(.. + xx=[274.2247;294.2247],.. + yy=[222.52782;222.52782],.. + id="drawlink",.. + thick=[0,0],.. + ct=[1,1],.. + from=[15,1,0],.. + to=[3,2,1]) + scs_m.objs(17)=scicos_block(.. + gui="IN_f",.. + graphics=scicos_graphics(.. + orig=[254.2247,202.52782],.. + sz=[20,20],.. + flip=%t,.. + theta=0,.. + exprs="3",.. + pin=[],.. + pout=18,.. + pein=[],.. + peout=[],.. + gr_i=[],.. + id="",.. + in_implicit=[],.. + out_implicit="E"),.. + model=scicos_model(.. + sim="input",.. + in=[],.. + in2=[],.. + intyp=1,.. + out=-1,.. + out2=[],.. + outtyp=-1,.. + evtin=[],.. + evtout=[],.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=[],.. + ipar=3,.. + opar=list(),.. + blocktype="c",.. + firing=[],.. + dep_ut=[%f,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m.objs(18)=scicos_link(.. + xx=[274.2247;294.2247],.. + yy=[212.52782;212.52782],.. + id="drawlink",.. + thick=[0,0],.. + ct=[1,1],.. + from=[17,1,0],.. + to=[3,3,1]) + scs_m.objs(19)=scicos_block(.. + gui="OUT_f",.. + graphics=scicos_graphics(.. + orig=[388.82793,233.45067],.. + sz=[20,20],.. + flip=%t,.. + theta=0,.. + exprs="1",.. + pin=20,.. + pout=[],.. + pein=[],.. + peout=[],.. + gr_i=[],.. + id="",.. + in_implicit="E",.. + out_implicit=[]),.. + model=scicos_model(.. + sim="output",.. + in=-1,.. + in2=[],.. + intyp=-1,.. + out=[],.. + out2=[],.. + outtyp=1,.. + evtin=[],.. + evtout=[],.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=[],.. + ipar=1,.. + opar=list(),.. + blocktype="c",.. + firing=[],.. + dep_ut=[%f,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m.objs(20)=scicos_link(.. + xx=[368.82793;388.82793],.. + yy=[243.45067;243.45067],.. + id="drawlink",.. + thick=[0,0],.. + ct=[1,1],.. + from=[6,2,0],.. + to=[19,1,1]) + scs_m.objs(21)=scicos_block(.. + gui="OUT_f",.. + graphics=scicos_graphics(.. + orig=[466.2036,169.25363],.. + sz=[20,20],.. + flip=%t,.. + theta=0,.. + exprs="2",.. + pin=22,.. + pout=[],.. + pein=[],.. + peout=[],.. + gr_i=[],.. + id="",.. + in_implicit="E",.. + out_implicit=[]),.. + model=scicos_model(.. + sim="output",.. + in=-1,.. + in2=[],.. + intyp=-1,.. + out=[],.. + out2=[],.. + outtyp=1,.. + evtin=[],.. + evtout=[],.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=[],.. + ipar=2,.. + opar=list(),.. + blocktype="c",.. + firing=[],.. + dep_ut=[%f,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m.objs(22)=scicos_link(.. + xx=[446.2036;466.2036],.. + yy=[179.25363;179.25363],.. + id="drawlink",.. + thick=[0,0],.. + ct=[1,1],.. + from=[9,1,0],.. + to=[21,1,1]) + model=scicos_model() + model.sim="csuper" + model.in=[1;1;1] + model.in2=[1;1;1] + model.out=[1;1] + model.out2=[1;1] + model.intyp=[5 1 5] + model.outtyp=[5 5] + model.blocktype="h" + model.firing=%f + model.dep_ut=[%t %f] + model.rpar=scs_m + gr_i=[] + x=standard_define([2 3],model,[],gr_i) + end +endfunction + diff --git a/macros/IntegerOp/LOGIC.sci b/macros/IntegerOp/LOGIC.sci new file mode 100644 index 00000000..c2778b82 --- /dev/null +++ b/macros/IntegerOp/LOGIC.sci @@ -0,0 +1,96 @@ +// Xcos +// +// Copyright (C) INRIA - METALAU Project <scicos@inria.fr> +// Copyright 2011 - Bernard DUJARDIN <bernard.dujardin@contrib.scilab.org> +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// See the file ../license.txt +// + +function [x,y,typ]=LOGIC(job,arg1,arg2) + x=[]; + y=[]; + typ=[]; + select job + case "set" then + x=arg1 + graphics=arg1.graphics; + exprs=graphics.exprs + model=arg1.model; + while %t do + [ok,mat,herit,exprs]=scicos_getvalue([msprintf(gettext("Set %s block parameters"), "LOGIC"); " ";gettext("Combinatorial logic");" "; + gettext(" Rows of the matrix are the output values"); gettext(" Number of rows must be a power of two."); .. + gettext(" Number of columns gives the number of outputs.");" "], .. + [gettext("Truth Table (matrix of outputs)"); gettext("Accepts Inherited Events (0:No, 1:Yes)")], .. + list("mat",[-1,-2],"vec",1), exprs); + + if ~ok then + break, + end + nout=size(mat,2) + nin=(log(size(mat,1))/log(2)) + u1=floor(nin) + //if (herit<>0) then herit=1;end; The test below verify the value of parameter + if (u1 <> nin) then + block_parameter_error(msprintf(gettext("Wrong size for ''%s'' parameter: %d."), gettext("Truth Table"), size(mat,1)), .. + gettext("Number of rows must be a power of two.")); + ok=%f; + elseif (find(mat(:) <> 0 & mat(:) <> 1) <> []) then + block_parameter_error(msprintf(gettext("Wrong value for ''%s'' parameter."), gettext("Truth Table")), .. + msprintf(gettext( "Elements must be in the interval %s."),"[0, 1]")); + ok=%f; + elseif herit <0 | herit > 1 then + block_parameter_error(msprintf(gettext("Wrong value for ''%s'' parameter: %d."), gettext("Accepts Inherited Events"), herit), .. + msprintf(gettext( "Must be in the interval %s."),"[0, 1]")); + ok=%f; + end + if ok then + in=[ones(nin,1) ones(nin,1)] + out=[ones(nout,1) ones(nout,1)] + it=5*ones(1,nin) + ot=5*ones(1,nout) + [model,graphics,ok]=set_io(model,graphics,list(in,it),list(out,ot),ones(1-herit,1),[]) + end + if ok then + graphics.exprs=exprs; + mat=int8(mat); + model.opar=list(mat); + x.graphics=graphics; + x.model=model; + break + end + end + case "define" then + mat=[0;0;0;1] + model=scicos_model() + model.sim=list("logic",4) + model.in=[1;1] + model.in2=[1;1] + model.out=1 + model.out2=1 + model.evtin=1 + model.intyp=[5 5] + model.outtyp=5 + model.opar=list(int8(mat)); + model.blocktype="c" + model.firing=%f + model.dep_ut=[%t %f] + exprs=[sci2exp(mat);sci2exp(0)] + gr_i=[] + x=standard_define([2 2],model,exprs,gr_i) + end +endfunction + diff --git a/macros/IntegerOp/SHIFT.sci b/macros/IntegerOp/SHIFT.sci new file mode 100644 index 00000000..01ce6bba --- /dev/null +++ b/macros/IntegerOp/SHIFT.sci @@ -0,0 +1,152 @@ +// Xcos +// +// Copyright (C) INRIA - METALAU Project <scicos@inria.fr> +// Copyright 2011 - Bernard DUJARDIN <bernard.dujardin@contrib.scilab.org> +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// See the file ../license.txt +// + +function [x,y,typ]=SHIFT(job,arg1,arg2) + x=[]; + y=[]; + typ=[]; + select job + case "set" then + x=arg1; + graphics=arg1.graphics + model=arg1.model + exprs=graphics.exprs + while %t do + [ok,Datatype,nb,np,exprs]=scicos_getvalue([msprintf(gettext("Set %s block parameters"), "SHIFT");" "; gettext("Shift/Rotates bits")], .. + [msprintf(gettext("Data Type %s"), "(3:int32, 4:int16, 5:int8, ...)"); gettext("Number of Bits to Shift Left (Negative number to shift right)"); .. + gettext("Shift Type (0:Arithmetic, 1:Circular)")], .. + list("vec",1,"vec",1,"vec",1), exprs); + + if ~ok then + break, + end + if (np ~= 0 & np ~= 1) then + block_parameter_error(msprintf( gettext("Wrong value for ''%s'' parameter: %d."), gettext("Shift Type"), np), .. + msprintf(gettext("Must be in the interval %s."), "[0, 1]")); + ok=%f; + end + it=Datatype; + ot=Datatype; + // model.sim=list('shift_ia',4) + if (Datatype==3 | Datatype==6) then + if nb>0 then + select np + case 0 then + model.sim=list("shift_32_LA",4) + case 1 then + model.sim=list("shift_32_LC",4) + end + elseif nb<0 + select np + case 0 then + select Datatype + case 3 then + model.sim=list("shift_32_RA",4) + case 6 then + model.sim=list("shift_u32_RA",4) + end + case 1 then + model.sim=list("shift_32_RC",4) + end + end + elseif (Datatype==4 | Datatype==7) then + if nb>0 then + select np + case 0 then + model.sim=list("shift_16_LA",4) + case 1 then + model.sim=list("shift_16_LC",4) + end + elseif nb<0 + select np + case 0 then + select Datatype + case 4 then + model.sim=list("shift_16_RA",4) + case 7 then + model.sim=list("shift_u16_RA",4) + end + case 1 then + model.sim=list("shift_16_RC",4) + end + end + elseif (Datatype==5 | Datatype==8) then + if nb>0 then + select np + case 0 then + model.sim=list("shift_8_LA",4) + case 1 then + model.sim=list("shift_8_LC",4) + end + elseif nb<0 + select np + case 0 then + select Datatype + case 5 then + model.sim=list("shift_8_RA",4) + case 8 then + model.sim=list("shift_u8_RA",4) + end + case 1 then + model.sim=list("shift_8_RC",4) + end + end + else + block_parameter_error(msprintf( gettext( "Wrong value for ''%s'' parameter: %d."), gettext("Data Type"), Datatype), .. + msprintf(gettext( "Must be in the interval %s."), "[3, 8]" )); + ok=%f; + end + if ok then + [model,graphics,ok]=set_io(model,graphics,... + list([-1,-2],it),... + list([-1,-2],ot),[],[]) + end + if ok then + model.ipar=nb + graphics.exprs=exprs + x.graphics=graphics; + x.model=model + break + end + end + case "define" then + sgn=[0;0] + OPER=0; + model=scicos_model() + model.sim=list("shift_32_LA",4) + model.in=-1 + model.out=-1 + model.in2=-2 + model.out2=-2 + model.intyp=3 + model.outtyp=3 + model.rpar=[] + model.ipar=sgn + model.blocktype="c" + model.dep_ut=[%t %f] + + + exprs=[sci2exp(3);sci2exp(0);sci2exp(0)] + gr_i=[] + x=standard_define([3 2],model, exprs,gr_i) + end +endfunction diff --git a/macros/IntegerOp/SRFLIPFLOP.sci b/macros/IntegerOp/SRFLIPFLOP.sci new file mode 100644 index 00000000..f0d5264f --- /dev/null +++ b/macros/IntegerOp/SRFLIPFLOP.sci @@ -0,0 +1,451 @@ +// Xcos +// +// Copyright (C) INRIA - METALAU Project <scicos@inria.fr> +// Copyright 2011 - Bernard DUJARDIN <bernard.dujardin@contrib.scilab.org> +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// See the file ../license.txt +// + +function [x,y,typ] = SRFLIPFLOP(job,arg1,arg2) + x=[]; + y=[]; + typ=[]; + select job + case "set" then + // look for the 1/z block + for i=1:length(arg1.model.rpar.objs) do + o = arg1.model.rpar.objs(i); + if typeof(o) == "Block" & o.gui == "DOLLAR_m" then + path = i; + break; + end + end + + newpar=list() + xx=arg1.model.rpar.objs(path)// get the 1/z block + exprs=xx.graphics.exprs(1) + model=xx.model; + init_old= model.odstate(1) + while %t do + [ok,init,exprs0]=scicos_getvalue([msprintf(gettext("Set %s block parameters"), "SRFLIPFLOP" );" "; gettext("SR flip-flop"); " "; .. + gettext("The ''Initial Value'' must be 0 or 1 of type int8"); gettext(" - Negative values are considered as int8(0)"); .. + gettext(" - Positive values are considered as int8(1)"); " "], .. + gettext("Initial Value"), .. + list("vec",1), exprs) + + if ~ok then + break, + end + if init<=0 then + init=int8(0); + elseif init >0 then + init=int8(1); + end + if ok then + xx.graphics.exprs(1)=exprs0 + model.odstate(1)=init + xx.model=model + arg1.model.rpar.objs(path)=xx// Update + break + end + end + needcompile=0 + if init_old<>init then + // parameter changed + newpar(size(newpar)+1)=path// Notify modification + needcompile=2 + end + x=arg1 + y=needcompile + typ=newpar + case "define" then + scs_m=scicos_diagram(.. + version="scicos4.2",.. + props=scicos_params(.. + wpar=[600,450,0,0,600,450],.. + Title=["SRFLIPFLOP"],.. + tol=[0.0001;0.000001;1.000E-10;100001;0;0;0],.. + tf=60,.. + context=" ",.. + void1=[],.. + options=tlist(["scsopt","3D","Background","Link","ID","Cmap"],list(%t,33),[8,1],[1,5],.. + list([5,1],[4,1]),[0.8,0.8,0.8]),.. + void2=[],.. + void3=[],.. + doc=list())) + scs_m.objs(1)=scicos_block(.. + gui="LOGIC",.. + graphics=scicos_graphics(.. + orig=[298.504,201.45067],.. + sz=[40,40],.. + flip=%t,.. + theta=0,.. + exprs=["[0 1;1 0;1 0;1 0;0 1;0 1;0 0;0 0]";"1"],.. + pin=[4;10;12],.. + pout=[3;8],.. + pein=[],.. + peout=[],.. + gr_i=[],.. + id="",.. + in_implicit=["E";"E";"E"],.. + out_implicit=["E";"E"]),.. + model=scicos_model(.. + sim=list("logic",4),.. + in=[1;1;1],.. + in2=[1;1;1],.. + intyp=[5;5;5],.. + out=[1;1],.. + out2=[1;1],.. + outtyp=[5;5],.. + evtin=[],.. + evtout=[],.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=[],.. + ipar=[],.. + opar=list(.. + int8([0,1; + 1,0; + 1,0; + 1,0; + 0,1; + 0,1; + 0,0; + 0,0])),.. + blocktype="c",.. + firing=%f,.. + dep_ut=[%t,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m.objs(2)=scicos_block(.. + gui="DOLLAR_m",.. + graphics=scicos_graphics(.. + orig=[299.23733,254.25067],.. + sz=[40,40],.. + flip=%f,.. + theta=0,.. + exprs=["int8(0)";"1"],.. + pin=6,.. + pout=4,.. + pein=[],.. + peout=[],.. + gr_i=[],.. + id="",.. + in_implicit="E",.. + out_implicit="E"),.. + model=scicos_model(.. + sim=list("dollar4_m",4),.. + in=1,.. + in2=1,.. + intyp=5,.. + out=1,.. + out2=1,.. + outtyp=5,.. + evtin=[],.. + evtout=[],.. + state=[],.. + dstate=[],.. + odstate=list(int8(0)),.. + rpar=[],.. + ipar=[],.. + opar=list(),.. + blocktype="d",.. + firing=[],.. + dep_ut=[%f,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m.objs(3)=scicos_link(.. + xx=[347.07543;363.03733;363.03733],.. + yy=[228.11733;228.11733;248.584],.. + id="drawlink",.. + thick=[0,0],.. + ct=[1,1],.. + from=[1,1,0],.. + to=[5,1,1]) + scs_m.objs(4)=scicos_link(.. + xx=[290.6659;272.104;272.104;289.93257],.. + yy=[274.25067;274.25067;231.45067;231.45067],.. + id="drawlink",.. + thick=[0,0],.. + ct=[1,1],.. + from=[2,1,0],.. + to=[1,1,1]) + scs_m.objs(5)=scicos_block(.. + gui="SPLIT_f",.. + graphics=scicos_graphics(.. + orig=[363.03733,248.584],.. + sz=[0.3333333,0.3333333],.. + flip=%t,.. + theta=0,.. + exprs=[],.. + pin=3,.. + pout=[6;14],.. + pein=[],.. + peout=[],.. + gr_i=[],.. + id="",.. + in_implicit="E",.. + out_implicit=["E";"E";"E"]),.. + model=scicos_model(.. + sim="lsplit",.. + in=-1,.. + in2=[],.. + intyp=1,.. + out=[-1;-1;-1],.. + out2=[],.. + outtyp=1,.. + evtin=[],.. + evtout=[],.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=[],.. + ipar=[],.. + opar=list(),.. + blocktype="c",.. + firing=[],.. + dep_ut=[%t,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m.objs(6)=scicos_link(.. + xx=[363.03733;363.03733;344.95162],.. + yy=[248.584;274.25067;274.25067],.. + id="drawlink",.. + thick=[0,0],.. + ct=[1,1],.. + from=[5,1,0],.. + to=[2,1,1]) + scs_m.objs(7)=scicos_block(.. + gui="OUT_f",.. + graphics=scicos_graphics(.. + orig=[367.07543,204.784],.. + sz=[20,20],.. + flip=%t,.. + theta=0,.. + exprs="2",.. + pin=8,.. + pout=[],.. + pein=[],.. + peout=[],.. + gr_i=[],.. + id="",.. + in_implicit="E",.. + out_implicit=[]),.. + model=scicos_model(.. + sim="output",.. + in=-1,.. + in2=[],.. + intyp=-1,.. + out=[],.. + out2=[],.. + outtyp=1,.. + evtin=[],.. + evtout=[],.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=[],.. + ipar=2,.. + opar=list(),.. + blocktype="c",.. + firing=[],.. + dep_ut=[%f,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m.objs(8)=scicos_link(.. + xx=[347.07543;367.07543],.. + yy=[214.784;214.784],.. + id="drawlink",.. + thick=[0,0],.. + ct=[1,1],.. + from=[1,2,0],.. + to=[7,1,1]) + scs_m.objs(9)=scicos_block(.. + gui="IN_f",.. + graphics=scicos_graphics(.. + orig=[249.93257,211.45067],.. + sz=[20,20],.. + flip=%t,.. + theta=0,.. + exprs="1",.. + pin=[],.. + pout=10,.. + pein=[],.. + peout=[],.. + gr_i=[],.. + id="",.. + in_implicit=[],.. + out_implicit="E"),.. + model=scicos_model(.. + sim="input",.. + in=[],.. + in2=[],.. + intyp=1,.. + out=-1,.. + out2=[],.. + outtyp=-1,.. + evtin=[],.. + evtout=[],.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=[],.. + ipar=1,.. + opar=list(),.. + blocktype="c",.. + firing=[],.. + dep_ut=[%f,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m.objs(10)=scicos_link(.. + xx=[269.93257;289.93257],.. + yy=[221.45067;221.45067],.. + id="drawlink",.. + thick=[0,0],.. + ct=[1,1],.. + from=[9,1,0],.. + to=[1,2,1]) + scs_m.objs(11)=scicos_block(.. + gui="IN_f",.. + graphics=scicos_graphics(.. + orig=[249.93257,201.45067],.. + sz=[20,20],.. + flip=%t,.. + theta=0,.. + exprs="2",.. + pin=[],.. + pout=12,.. + pein=[],.. + peout=[],.. + gr_i=[],.. + id="",.. + in_implicit=[],.. + out_implicit="E"),.. + model=scicos_model(.. + sim="input",.. + in=[],.. + in2=[],.. + intyp=1,.. + out=-1,.. + out2=[],.. + outtyp=-1,.. + evtin=[],.. + evtout=[],.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=[],.. + ipar=2,.. + opar=list(),.. + blocktype="c",.. + firing=[],.. + dep_ut=[%f,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m.objs(12)=scicos_link(.. + xx=[269.93257;289.93257],.. + yy=[211.45067;211.45067],.. + id="drawlink",.. + thick=[0,0],.. + ct=[1,1],.. + from=[11,1,0],.. + to=[1,3,1]) + scs_m.objs(13)=scicos_block(.. + gui="OUT_f",.. + graphics=scicos_graphics(.. + orig=[383.03733,238.584],.. + sz=[20,20],.. + flip=%t,.. + theta=0,.. + exprs="1",.. + pin=14,.. + pout=[],.. + pein=[],.. + peout=[],.. + gr_i=[],.. + id="",.. + in_implicit="E",.. + out_implicit=[]),.. + model=scicos_model(.. + sim="output",.. + in=-1,.. + in2=[],.. + intyp=-1,.. + out=[],.. + out2=[],.. + outtyp=1,.. + evtin=[],.. + evtout=[],.. + state=[],.. + dstate=[],.. + odstate=list(),.. + rpar=[],.. + ipar=1,.. + opar=list(),.. + blocktype="c",.. + firing=[],.. + dep_ut=[%f,%f],.. + label="",.. + nzcross=0,.. + nmode=0,.. + equations=list()),.. + doc=list()) + scs_m.objs(14)=scicos_link(.. + xx=[363.03733;383.03733],.. + yy=[248.584;248.584],.. + id="drawlink",.. + thick=[0,0],.. + ct=[1,1],.. + from=[5,2,0],.. + to=[13,1,1]) + + model=scicos_model() + model.sim="csuper" + model.in=[1;1] + model.in2=[1;1] + model.out=[1;1] + model.out2=[1;1] + model.intyp=[5 5] + model.outtyp=[5 5] + model.blocktype="h" + model.firing=%f + model.dep_ut=[%t %f] + model.rpar=scs_m + gr_i=[] + x=standard_define([2 3],model,[],gr_i) + end +endfunction + |