diff options
Diffstat (limited to 'js/IntegerOp')
-rw-r--r-- | js/IntegerOp/BITCLEAR.js | 117 | ||||
-rw-r--r-- | js/IntegerOp/BITCLEAR.pickle | 6 | ||||
-rw-r--r-- | js/IntegerOp/BITSET.js | 113 | ||||
-rw-r--r-- | js/IntegerOp/BITSET.pickle | 6 | ||||
-rw-r--r-- | js/IntegerOp/CONVERT.js | 681 | ||||
-rw-r--r-- | js/IntegerOp/CONVERT.pickle | 6 | ||||
-rw-r--r-- | js/IntegerOp/DFLIPFLOP.js | 5 | ||||
-rw-r--r-- | js/IntegerOp/DFLIPFLOP.pickle | 6 | ||||
-rw-r--r-- | js/IntegerOp/DLATCH.js | 5 | ||||
-rw-r--r-- | js/IntegerOp/DLATCH.pickle | 6 | ||||
-rw-r--r-- | js/IntegerOp/EXTRACTBITS.js | 401 | ||||
-rw-r--r-- | js/IntegerOp/EXTRACTBITS.pickle | 6 | ||||
-rw-r--r-- | js/IntegerOp/INTMUL.js | 153 | ||||
-rw-r--r-- | js/IntegerOp/INTMUL.pickle | 6 | ||||
-rw-r--r-- | js/IntegerOp/JKFLIPFLOP.js | 59 | ||||
-rw-r--r-- | js/IntegerOp/JKFLIPFLOP.pickle | 6 | ||||
-rw-r--r-- | js/IntegerOp/LOGIC.js | 71 | ||||
-rw-r--r-- | js/IntegerOp/LOGIC.pickle | 6 | ||||
-rw-r--r-- | js/IntegerOp/SHIFT.js | 181 | ||||
-rw-r--r-- | js/IntegerOp/SHIFT.pickle | 6 | ||||
-rw-r--r-- | js/IntegerOp/SRFLIPFLOP.js | 59 | ||||
-rw-r--r-- | js/IntegerOp/SRFLIPFLOP.pickle | 6 |
22 files changed, 972 insertions, 939 deletions
diff --git a/js/IntegerOp/BITCLEAR.js b/js/IntegerOp/BITCLEAR.js index a7f8cbd6..69a6c8e9 100644 --- a/js/IntegerOp/BITCLEAR.js +++ b/js/IntegerOp/BITCLEAR.js @@ -14,73 +14,74 @@ function BITCLEAR() { model.dep_ut = [true,false]; exprs = [[sci2exp(3)],[sci2exp(0)]]; gr_i = []; - x = standard_define([4,2],model,exprs,gr_i); + this.x = standard_define([4,2],model,exprs,gr_i); } BITCLEAR.prototype.details = function BITCLEAR() { + return this.x; } BITCLEAR.prototype.get = function BITCLEAR() { } BITCLEAR.prototype.set = function BITCLEAR() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [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) { -break; -} - in1 = [model.in1,model.in2]; - if (floor(bit)!=bit) { -block_parameter_error(msprintf(gettext("Wrong type for \'%s\' parameter: %5.1f."),gettext("Index of Bit"),bit),gettext("Must be integer.")); - ok = false; - } else if ((Datatype==3)||(Datatype==6)) { - if (bit>31||bit<0) { -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 = false; - } else { - bit = uint32(bit); - n = (2^32-1)-2^bit; - n = uint32(n); - model.sim = list("bit_clear_32",4); -} - } else if ((Datatype==4)||(Datatype==7)) { - if (bit>15||bit<0) { -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 = false; - } else { - bit = uint16(bit); - n = (2^16-1)-2^bit; - n = uint16(n); - model.sim = list("bit_clear_16",4); -} - } else if ((Datatype==5)||(Datatype==8)) { - if (bit>7||bit<0) { -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 = false; - } else { - bit = uint8(bit); - n = (2^8-1)-2^bit; - n = uint8(n); - model.sim = list("bit_clear_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 = false; -} - if (ok) { - it = Datatype; - ot = Datatype; - out = [1,1]; - [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); -} - if (ok) { - graphics.exprs = exprs; - model.opar = list(n); - x.graphics = graphics; - x.model = model; -break; -} -} + [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) { + break; + } + in1 = [model.in1,model.in2]; + if (floor(bit)!=bit) { + block_parameter_error(msprintf(gettext("Wrong type for \'%s\' parameter: %5.1f."),gettext("Index of Bit"),bit),gettext("Must be integer.")); + ok = false; + } else if ((Datatype==3)||(Datatype==6)) { + if (bit>31||bit<0) { + 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 = false; + } else { + bit = uint32(bit); + n = (2^32-1)-2^bit; + n = uint32(n); + model.sim = list("bit_clear_32",4); + } + } else if ((Datatype==4)||(Datatype==7)) { + if (bit>15||bit<0) { + 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 = false; + } else { + bit = uint16(bit); + n = (2^16-1)-2^bit; + n = uint16(n); + model.sim = list("bit_clear_16",4); + } + } else if ((Datatype==5)||(Datatype==8)) { + if (bit>7||bit<0) { + 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 = false; + } else { + bit = uint8(bit); + n = (2^8-1)-2^bit; + n = uint8(n); + model.sim = list("bit_clear_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 = false; + } + if (ok) { + it = Datatype; + ot = Datatype; + out = [1,1]; + [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); + } + if (ok) { + graphics.exprs = exprs; + model.opar = list(n); + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/IntegerOp/BITCLEAR.pickle b/js/IntegerOp/BITCLEAR.pickle index 154645d8..0d1dde24 100644 --- a/js/IntegerOp/BITCLEAR.pickle +++ b/js/IntegerOp/BITCLEAR.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 .
\ No newline at end of file diff --git a/js/IntegerOp/BITSET.js b/js/IntegerOp/BITSET.js index eedd3092..b214103d 100644 --- a/js/IntegerOp/BITSET.js +++ b/js/IntegerOp/BITSET.js @@ -14,71 +14,72 @@ function BITSET() { model.dep_ut = [true,false]; exprs = [[sci2exp(3)],[sci2exp(0)]]; gr_i = []; - x = standard_define([4,2],model,exprs,gr_i); + this.x = standard_define([4,2],model,exprs,gr_i); } BITSET.prototype.details = function BITSET() { + return this.x; } BITSET.prototype.get = function BITSET() { } BITSET.prototype.set = function BITSET() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [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) { -break; -} - in1 = [model.in1,model.in2]; - if (floor(bit)!=bit) { -block_parameter_error(msprintf(gettext("Wrong type for \'%s\' parameter: %5.1f."),gettext("Index of Bit"),bit),gettext("Must be integer.")); - ok = false; -} - if ((Datatype==3)||(Datatype==6)) { - if (bit>31||bit<0) { -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 = false; -} - bit = uint32(bit); - n = 2^bit; - n = uint32(n); - model.sim = list("bit_set_32",4); - } else if ((Datatype==4)||(Datatype==7)) { - if (bit>15||bit<0) { -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 = false; -} - bit = uint16(bit); - n = 2^bit; - n = uint16(n); - model.sim = list("bit_set_16",4); - } else if ((Datatype==5)||(Datatype==8)) { - if (bit>7||bit<0) { -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 = false; -} - 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 = false; -} - if (ok) { - it = Datatype; - ot = Datatype; - out = [1,1]; - [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); -} - if (ok) { - graphics.exprs = exprs; - model.opar = list(n); - x.graphics = graphics; - x.model = model; -break; -} -} + [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) { + break; + } + in1 = [model.in1,model.in2]; + if (floor(bit)!=bit) { + block_parameter_error(msprintf(gettext("Wrong type for \'%s\' parameter: %5.1f."),gettext("Index of Bit"),bit),gettext("Must be integer.")); + ok = false; + } + if ((Datatype==3)||(Datatype==6)) { + if (bit>31||bit<0) { + 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 = false; + } + bit = uint32(bit); + n = 2^bit; + n = uint32(n); + model.sim = list("bit_set_32",4); + } else if ((Datatype==4)||(Datatype==7)) { + if (bit>15||bit<0) { + 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 = false; + } + bit = uint16(bit); + n = 2^bit; + n = uint16(n); + model.sim = list("bit_set_16",4); + } else if ((Datatype==5)||(Datatype==8)) { + if (bit>7||bit<0) { + 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 = false; + } + 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 = false; + } + if (ok) { + it = Datatype; + ot = Datatype; + out = [1,1]; + [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); + } + if (ok) { + graphics.exprs = exprs; + model.opar = list(n); + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/IntegerOp/BITSET.pickle b/js/IntegerOp/BITSET.pickle index 154645d8..0d1dde24 100644 --- a/js/IntegerOp/BITSET.pickle +++ b/js/IntegerOp/BITSET.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 .
\ No newline at end of file diff --git a/js/IntegerOp/CONVERT.js b/js/IntegerOp/CONVERT.js index b0106c7e..7686794e 100644 --- a/js/IntegerOp/CONVERT.js +++ b/js/IntegerOp/CONVERT.js @@ -16,355 +16,356 @@ function CONVERT() { model.dep_ut = [true,false]; exprs = [[sci2exp(1)],[sci2exp(3)],[sci2exp(0)]]; gr_i = []; - x = standard_define([3,2],model,exprs,gr_i); + this.x = standard_define([3,2],model,exprs,gr_i); } CONVERT.prototype.details = function CONVERT() { + return this.x; } CONVERT.prototype.get = function CONVERT() { } CONVERT.prototype.set = function CONVERT() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; model = arg1.model; exprs = graphics.exprs; while (true) { - [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) { -break; -} - if (it==2) { - it = 1; -} - if (ot==2) { - ot = 1; -} - if ((np!=0&&np!=1&&np!=2)) { -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 = false; - } else if ((it>8||it<1)) { -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 = false; - } else if ((ot>8||ot<1)) { -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 = false; -} - model.sim = list("convert",4); - if ((it==ot)) { - model.ipar = 1; - } else { - if ((np==0)) { - if ((it==1)) { - if ((ot==3)) { - model.ipar = 2; - } else if ((ot==4)) { - model.ipar = 3; - } else if ((ot==5)) { - model.ipar = 4; - } else if ((ot==6)) { - model.ipar = 5; - } else if ((ot==7)) { - model.ipar = 6; - } else if ((ot==8)) { - model.ipar = 7; -} - } else if ((it==3)) { - if ((ot==1)) { - model.ipar = 8; - } else if ((ot==4)) { - model.ipar = 9; - } else if ((ot==5)) { - model.ipar = 10; - } else if ((ot==6)) { - model.ipar = 1; - } else if ((ot==7)) { - model.ipar = 11; - } else if ((ot==8)) { - model.ipar = 12; -} - } else if ((it==4)) { - if ((ot==1)) { - model.ipar = 13; - } else if ((ot==3)) { - model.ipar = 14; - } else if ((ot==5)) { - model.ipar = 15; - } else if ((ot==6)) { - model.ipar = 16; - } else if ((ot==7)) { - model.ipar = 1; - } else if ((ot==8)) { - model.ipar = 17; -} - } else if ((it==5)) { - if ((ot==1)) { - model.ipar = 18; - } else if ((ot==3)) { - model.ipar = 19; - } else if ((ot==4)) { - model.ipar = 20; - } else if ((ot==6)) { - model.ipar = 21; - } else if ((ot==7)) { - model.ipar = 22; - } else if ((ot==8)) { - model.ipar = 1; -} - } else if ((it==6)) { - if ((ot==1)) { - model.ipar = 23; - } else if ((ot==3)) { - model.ipar = 1; - } else if ((ot==4)) { - model.ipar = 24; - } else if ((ot==5)) { - model.ipar = 25; - } else if ((ot==7)) { - model.ipar = 26; - } else if ((ot==8)) { - model.ipar = 27; -} - } else if ((it==7)) { - if ((ot==1)) { - model.ipar = 28; - } else if ((ot==3)) { - model.ipar = 29; - } else if ((ot==4)) { - model.ipar = 1; - } else if ((ot==5)) { - model.ipar = 30; - } else if ((ot==6)) { - model.ipar = 31; - } else if ((ot==8)) { - model.ipar = 32; -} - } else if ((it==8)) { - if ((ot==1)) { - model.ipar = 33; - } else if ((ot==3)) { - model.ipar = 34; - } else if ((ot==4)) { - model.ipar = 35; - } else if ((ot==5)) { - model.ipar = 1; - } else if ((ot==6)) { - model.ipar = 36; - } else if ((ot==7)) { - model.ipar = 37; -} -} - } else if ((np==1)) { - if ((it==1)) { - if ((ot==3)) { - model.ipar = 38; - } else if ((ot==4)) { - model.ipar = 39; - } else if ((ot==5)) { - model.ipar = 40; - } else if ((ot==6)) { - model.ipar = 41; - } else if ((ot==7)) { - model.ipar = 42; - } else if ((ot==8)) { - model.ipar = 43; -} - } else if ((it==3)) { - if ((ot==1)) { - model.ipar = 8; - } else if ((ot==4)) { - model.ipar = 44; - } else if ((ot==5)) { - model.ipar = 45; - } else if ((ot==6)) { - model.ipar = 46; - } else if ((ot==7)) { - model.ipar = 47; - } else if ((ot==8)) { - model.ipar = 48; -} - } else if ((it==4)) { - if ((ot==1)) { - model.ipar = 13; - } else if ((ot==3)) { - model.ipar = 14; - } else if ((ot==5)) { - model.ipar = 49; - } else if ((ot==6)) { - model.ipar = 50; - } else if ((ot==7)) { - model.ipar = 51; - } else if ((ot==8)) { - model.ipar = 52; -} - } else if ((it==5)) { - if ((ot==1)) { - model.ipar = 18; - } else if ((ot==3)) { - model.ipar = 19; - } else if ((ot==4)) { - model.ipar = 20; - } else if ((ot==6)) { - model.ipar = 53; - } else if ((ot==7)) { - model.ipar = 54; - } else if ((ot==8)) { - model.ipar = 55; -} - } else if ((it==6)) { - if ((ot==1)) { - model.ipar = 23; - } else if ((ot==3)) { - model.ipar = 56; - } else if ((ot==4)) { - model.ipar = 57; - } else if ((ot==5)) { - model.ipar = 58; - } else if ((ot==7)) { - model.ipar = 59; - } else if ((ot==8)) { - model.ipar = 60; -} - } else if ((it==7)) { - if ((ot==1)) { - model.ipar = 28; - } else if ((ot==3)) { - model.ipar = 29; - } else if ((ot==4)) { - model.ipar = 61; - } else if ((ot==5)) { - model.ipar = 62; - } else if ((ot==6)) { - model.ipar = 31; - } else if ((ot==8)) { - model.ipar = 63; -} - } else if ((it==8)) { - if ((ot==1)) { - model.ipar = 33; - } else if ((ot==3)) { - model.ipar = 34; - } else if ((ot==4)) { - model.ipar = 35; - } else if ((ot==5)) { - model.ipar = 64; - } else if ((ot==6)) { - model.ipar = 36; - } else if ((ot==7)) { - model.ipar = 37; -} -} - } else if ((np==2)) { - if ((it==1)) { - if ((ot==3)) { - model.ipar = 65; - } else if ((ot==4)) { - model.ipar = 66; - } else if ((ot==5)) { - model.ipar = 67; - } else if ((ot==6)) { - model.ipar = 68; - } else if ((ot==7)) { - model.ipar = 69; - } else if ((ot==8)) { - model.ipar = 70; -} - } else if ((it==3)) { - if ((ot==1)) { - model.ipar = 8; - } else if ((ot==4)) { - model.ipar = 71; - } else if ((ot==5)) { - model.ipar = 72; - } else if ((ot==6)) { - model.ipar = 73; - } else if ((ot==7)) { - model.ipar = 74; - } else if ((ot==8)) { - model.ipar = 75; -} - } else if ((it==4)) { - if ((ot==1)) { - model.ipar = 13; - } else if ((ot==3)) { - model.ipar = 14; - } else if ((ot==5)) { - model.ipar = 76; - } else if ((ot==6)) { - model.ipar = 77; - } else if ((ot==7)) { - model.ipar = 78; - } else if ((ot==8)) { - model.ipar = 79; -} - } else if ((it==5)) { - if ((ot==1)) { - model.ipar = 18; - } else if ((ot==3)) { - model.ipar = 19; - } else if ((ot==4)) { - model.ipar = 20; - } else if ((ot==6)) { - model.ipar = 80; - } else if ((ot==7)) { - model.ipar = 81; - } else if ((ot==8)) { - model.ipar = 82; -} - } else if ((it==6)) { - if ((ot==1)) { - model.ipar = 23; - } else if ((ot==3)) { - model.ipar = 83; - } else if ((ot==4)) { - model.ipar = 84; - } else if ((ot==5)) { - model.ipar = 85; - } else if ((ot==7)) { - model.ipar = 86; - } else if ((ot==8)) { - model.ipar = 87; -} - } else if ((it==7)) { - if ((ot==1)) { - model.ipar = 28; - } else if ((ot==3)) { - model.ipar = 29; - } else if ((ot==4)) { - model.ipar = 88; - } else if ((ot==5)) { - model.ipar = 89; - } else if ((ot==6)) { - model.ipar = 31; - } else if ((ot==8)) { - model.ipar = 90; -} - } else if ((it==8)) { - if ((ot==1)) { - model.ipar = 33; - } else if ((ot==3)) { - model.ipar = 34; - } else if ((ot==4)) { - model.ipar = 35; - } else if ((ot==5)) { - model.ipar = 91; - } else if ((ot==6)) { - model.ipar = 36; - } else if ((ot==7)) { - model.ipar = 37; -} -} -} -} - in1 = [model.in1,model.in2]; - out = [model.out,model.out2]; - if (ok) { - [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); -} - if (ok) { - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [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) { + break; + } + if (it==2) { + it = 1; + } + if (ot==2) { + ot = 1; + } + if ((np!=0&&np!=1&&np!=2)) { + 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 = false; + } else if ((it>8||it<1)) { + 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 = false; + } else if ((ot>8||ot<1)) { + 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 = false; + } + model.sim = list("convert",4); + if ((it==ot)) { + model.ipar = 1; + } else { + if ((np==0)) { + if ((it==1)) { + if ((ot==3)) { + model.ipar = 2; + } else if ((ot==4)) { + model.ipar = 3; + } else if ((ot==5)) { + model.ipar = 4; + } else if ((ot==6)) { + model.ipar = 5; + } else if ((ot==7)) { + model.ipar = 6; + } else if ((ot==8)) { + model.ipar = 7; + } + } else if ((it==3)) { + if ((ot==1)) { + model.ipar = 8; + } else if ((ot==4)) { + model.ipar = 9; + } else if ((ot==5)) { + model.ipar = 10; + } else if ((ot==6)) { + model.ipar = 1; + } else if ((ot==7)) { + model.ipar = 11; + } else if ((ot==8)) { + model.ipar = 12; + } + } else if ((it==4)) { + if ((ot==1)) { + model.ipar = 13; + } else if ((ot==3)) { + model.ipar = 14; + } else if ((ot==5)) { + model.ipar = 15; + } else if ((ot==6)) { + model.ipar = 16; + } else if ((ot==7)) { + model.ipar = 1; + } else if ((ot==8)) { + model.ipar = 17; + } + } else if ((it==5)) { + if ((ot==1)) { + model.ipar = 18; + } else if ((ot==3)) { + model.ipar = 19; + } else if ((ot==4)) { + model.ipar = 20; + } else if ((ot==6)) { + model.ipar = 21; + } else if ((ot==7)) { + model.ipar = 22; + } else if ((ot==8)) { + model.ipar = 1; + } + } else if ((it==6)) { + if ((ot==1)) { + model.ipar = 23; + } else if ((ot==3)) { + model.ipar = 1; + } else if ((ot==4)) { + model.ipar = 24; + } else if ((ot==5)) { + model.ipar = 25; + } else if ((ot==7)) { + model.ipar = 26; + } else if ((ot==8)) { + model.ipar = 27; + } + } else if ((it==7)) { + if ((ot==1)) { + model.ipar = 28; + } else if ((ot==3)) { + model.ipar = 29; + } else if ((ot==4)) { + model.ipar = 1; + } else if ((ot==5)) { + model.ipar = 30; + } else if ((ot==6)) { + model.ipar = 31; + } else if ((ot==8)) { + model.ipar = 32; + } + } else if ((it==8)) { + if ((ot==1)) { + model.ipar = 33; + } else if ((ot==3)) { + model.ipar = 34; + } else if ((ot==4)) { + model.ipar = 35; + } else if ((ot==5)) { + model.ipar = 1; + } else if ((ot==6)) { + model.ipar = 36; + } else if ((ot==7)) { + model.ipar = 37; + } + } + } else if ((np==1)) { + if ((it==1)) { + if ((ot==3)) { + model.ipar = 38; + } else if ((ot==4)) { + model.ipar = 39; + } else if ((ot==5)) { + model.ipar = 40; + } else if ((ot==6)) { + model.ipar = 41; + } else if ((ot==7)) { + model.ipar = 42; + } else if ((ot==8)) { + model.ipar = 43; + } + } else if ((it==3)) { + if ((ot==1)) { + model.ipar = 8; + } else if ((ot==4)) { + model.ipar = 44; + } else if ((ot==5)) { + model.ipar = 45; + } else if ((ot==6)) { + model.ipar = 46; + } else if ((ot==7)) { + model.ipar = 47; + } else if ((ot==8)) { + model.ipar = 48; + } + } else if ((it==4)) { + if ((ot==1)) { + model.ipar = 13; + } else if ((ot==3)) { + model.ipar = 14; + } else if ((ot==5)) { + model.ipar = 49; + } else if ((ot==6)) { + model.ipar = 50; + } else if ((ot==7)) { + model.ipar = 51; + } else if ((ot==8)) { + model.ipar = 52; + } + } else if ((it==5)) { + if ((ot==1)) { + model.ipar = 18; + } else if ((ot==3)) { + model.ipar = 19; + } else if ((ot==4)) { + model.ipar = 20; + } else if ((ot==6)) { + model.ipar = 53; + } else if ((ot==7)) { + model.ipar = 54; + } else if ((ot==8)) { + model.ipar = 55; + } + } else if ((it==6)) { + if ((ot==1)) { + model.ipar = 23; + } else if ((ot==3)) { + model.ipar = 56; + } else if ((ot==4)) { + model.ipar = 57; + } else if ((ot==5)) { + model.ipar = 58; + } else if ((ot==7)) { + model.ipar = 59; + } else if ((ot==8)) { + model.ipar = 60; + } + } else if ((it==7)) { + if ((ot==1)) { + model.ipar = 28; + } else if ((ot==3)) { + model.ipar = 29; + } else if ((ot==4)) { + model.ipar = 61; + } else if ((ot==5)) { + model.ipar = 62; + } else if ((ot==6)) { + model.ipar = 31; + } else if ((ot==8)) { + model.ipar = 63; + } + } else if ((it==8)) { + if ((ot==1)) { + model.ipar = 33; + } else if ((ot==3)) { + model.ipar = 34; + } else if ((ot==4)) { + model.ipar = 35; + } else if ((ot==5)) { + model.ipar = 64; + } else if ((ot==6)) { + model.ipar = 36; + } else if ((ot==7)) { + model.ipar = 37; + } + } + } else if ((np==2)) { + if ((it==1)) { + if ((ot==3)) { + model.ipar = 65; + } else if ((ot==4)) { + model.ipar = 66; + } else if ((ot==5)) { + model.ipar = 67; + } else if ((ot==6)) { + model.ipar = 68; + } else if ((ot==7)) { + model.ipar = 69; + } else if ((ot==8)) { + model.ipar = 70; + } + } else if ((it==3)) { + if ((ot==1)) { + model.ipar = 8; + } else if ((ot==4)) { + model.ipar = 71; + } else if ((ot==5)) { + model.ipar = 72; + } else if ((ot==6)) { + model.ipar = 73; + } else if ((ot==7)) { + model.ipar = 74; + } else if ((ot==8)) { + model.ipar = 75; + } + } else if ((it==4)) { + if ((ot==1)) { + model.ipar = 13; + } else if ((ot==3)) { + model.ipar = 14; + } else if ((ot==5)) { + model.ipar = 76; + } else if ((ot==6)) { + model.ipar = 77; + } else if ((ot==7)) { + model.ipar = 78; + } else if ((ot==8)) { + model.ipar = 79; + } + } else if ((it==5)) { + if ((ot==1)) { + model.ipar = 18; + } else if ((ot==3)) { + model.ipar = 19; + } else if ((ot==4)) { + model.ipar = 20; + } else if ((ot==6)) { + model.ipar = 80; + } else if ((ot==7)) { + model.ipar = 81; + } else if ((ot==8)) { + model.ipar = 82; + } + } else if ((it==6)) { + if ((ot==1)) { + model.ipar = 23; + } else if ((ot==3)) { + model.ipar = 83; + } else if ((ot==4)) { + model.ipar = 84; + } else if ((ot==5)) { + model.ipar = 85; + } else if ((ot==7)) { + model.ipar = 86; + } else if ((ot==8)) { + model.ipar = 87; + } + } else if ((it==7)) { + if ((ot==1)) { + model.ipar = 28; + } else if ((ot==3)) { + model.ipar = 29; + } else if ((ot==4)) { + model.ipar = 88; + } else if ((ot==5)) { + model.ipar = 89; + } else if ((ot==6)) { + model.ipar = 31; + } else if ((ot==8)) { + model.ipar = 90; + } + } else if ((it==8)) { + if ((ot==1)) { + model.ipar = 33; + } else if ((ot==3)) { + model.ipar = 34; + } else if ((ot==4)) { + model.ipar = 35; + } else if ((ot==5)) { + model.ipar = 91; + } else if ((ot==6)) { + model.ipar = 36; + } else if ((ot==7)) { + model.ipar = 37; + } + } + } + } + in1 = [model.in1,model.in2]; + out = [model.out,model.out2]; + if (ok) { + [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); + } + if (ok) { + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/IntegerOp/CONVERT.pickle b/js/IntegerOp/CONVERT.pickle index 154645d8..0d1dde24 100644 --- a/js/IntegerOp/CONVERT.pickle +++ b/js/IntegerOp/CONVERT.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 .
\ No newline at end of file diff --git a/js/IntegerOp/DFLIPFLOP.js b/js/IntegerOp/DFLIPFLOP.js index 1831526e..5a703f00 100644 --- a/js/IntegerOp/DFLIPFLOP.js +++ b/js/IntegerOp/DFLIPFLOP.js @@ -89,13 +89,14 @@ function DFLIPFLOP() { model.dep_ut = [true,false]; model.rpar = scs_m; gr_i = []; - x = standard_define([2,3],model,[],gr_i); + this.x = standard_define([2,3],model,[],gr_i); } DFLIPFLOP.prototype.details = function DFLIPFLOP() { + return this.x; } DFLIPFLOP.prototype.get = function DFLIPFLOP() { } DFLIPFLOP.prototype.set = function DFLIPFLOP() { - x = arg1; + this.x = arg1; } } diff --git a/js/IntegerOp/DFLIPFLOP.pickle b/js/IntegerOp/DFLIPFLOP.pickle index 154645d8..0d1dde24 100644 --- a/js/IntegerOp/DFLIPFLOP.pickle +++ b/js/IntegerOp/DFLIPFLOP.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 .
\ No newline at end of file diff --git a/js/IntegerOp/DLATCH.js b/js/IntegerOp/DLATCH.js index a5d6633f..174cfa92 100644 --- a/js/IntegerOp/DLATCH.js +++ b/js/IntegerOp/DLATCH.js @@ -34,13 +34,14 @@ function DLATCH() { model.dep_ut = [true,false]; model.rpar = scs_m; gr_i = []; - x = standard_define([2,3],model,[],gr_i); + this.x = standard_define([2,3],model,[],gr_i); } DLATCH.prototype.details = function DLATCH() { + return this.x; } DLATCH.prototype.get = function DLATCH() { } DLATCH.prototype.set = function DLATCH() { - x = arg1; + this.x = arg1; } } diff --git a/js/IntegerOp/DLATCH.pickle b/js/IntegerOp/DLATCH.pickle index 154645d8..0d1dde24 100644 --- a/js/IntegerOp/DLATCH.pickle +++ b/js/IntegerOp/DLATCH.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 .
\ No newline at end of file diff --git a/js/IntegerOp/EXTRACTBITS.js b/js/IntegerOp/EXTRACTBITS.js index a2f1a280..c8cc060a 100644 --- a/js/IntegerOp/EXTRACTBITS.js +++ b/js/IntegerOp/EXTRACTBITS.js @@ -15,215 +15,216 @@ function EXTRACTBITS() { model.dep_ut = [true,false]; exprs = [[sci2exp(3)],[sci2exp(1)],[sci2exp(0)],[sci2exp(0)]]; gr_i = []; - x = standard_define([4,2],model,exprs,gr_i); + this.x = standard_define([4,2],model,exprs,gr_i); } EXTRACTBITS.prototype.details = function EXTRACTBITS() { + return this.x; } EXTRACTBITS.prototype.get = function EXTRACTBITS() { } EXTRACTBITS.prototype.set = function EXTRACTBITS() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [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) { -break; -} - bitstr = strcat(string(bit.slice())," "); - if ((rule<1)||(rule>5)) { -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 = false; - } else if (scal<0||scal>1) { -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 = false; - } else { - in1 = [model.in1,model.in2]; - bit = int(bit); - rule = int(rule); - if ((rule==3)||(rule==4)) { - if ((size(bit,"*")!=1)) { -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 = false; - } else { - numb = bit; -} - } else if ((rule==5)) { - if ((size(bit,"*")!=2)) { -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 = false; - } else if (bit[1-1]>bit[2-1]) { -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 = false; - } else { - numb = bit[2-1]-bit[1-1]; -} - } else { - bit = 0; - numb = []; -} -} - if (ok) { - if ((Datatype==3||Datatype==6)) { - if (or(bit.slice()>31)||or(bit.slice()<0)) { -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 = false; -} - switch (rule) { - case 1: - switch (scal) { - case 0: - model.sim = list("extract_bit_32_UH0",4); - case 1: - switch (Datatype) { - case 3: - model.sim = list("extract_bit_32_UH1",4); - case 6: - model.sim = list("extract_bit_u32_UH1",4); -} -} - case 2: - model.sim = list("extract_bit_32_LH",4); - case 3: - switch (scal) { - case 0: - model.sim = list("extract_bit_32_MSB0",4); - case 1: - switch (Datatype) { - case 3: - model.sim = list("extract_bit_32_MSB1",4); - case 6: - model.sim = list("extract_bit_u32_MSB1",4); -} -} - case 4: - model.sim = list("extract_bit_32_LSB",4); - case 5: - switch (scal) { - case 0: - model.sim = list("extract_bit_32_RB0",4); - case 1: - switch (Datatype) { - case 3: - model.sim = list("extract_bit_32_RB1",4); - case 6: - model.sim = list("extract_bit_u32_RB1",4); -} -} -} - } else if ((Datatype==4||Datatype==7)) { - if (or(bit.slice()>15)||or(bit.slice()<0)) { -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 = false; -} - switch (rule) { - case 1: - switch (scal) { - case 0: - model.sim = list("extract_bit_16_UH0",4); - case 1: - switch (Datatype) { - case 4: - model.sim = list("extract_bit_16_UH1",4); - case 7: - model.sim = list("extract_bit_u16_UH1",4); -} -} - case 2: - model.sim = list("extract_bit_16_LH",4); - case 3: - switch (scal) { - case 0: - model.sim = list("extract_bit_16_MSB0",4); - case 1: - switch (Datatype) { - case 4: - model.sim = list("extract_bit_16_MSB1",4); - case 7: - model.sim = list("extract_bit_u16_MSB1",4); -} -} - case 4: - model.sim = list("extract_bit_16_LSB",4); - case 5: - switch (scal) { - case 0: - model.sim = list("extract_bit_16_RB0",4); - case 1: - switch (Datatype) { - case 4: - model.sim = list("extract_bit_16_RB1",4); - case 7: - model.sim = list("extract_bit_u16_RB1",4); -} -} -} - } else if ((Datatype==5||Datatype==8)) { - if (or(bit.slice()>7)||or(bit.slice()<0)) { -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 = false; -} - switch (rule) { - case 1: - switch (scal) { - case 0: - model.sim = list("extract_bit_8_UH0",4); - case 1: - switch (Datatype) { - case 5: - model.sim = list("extract_bit_8_UH1",4); - case 8: - model.sim = list("extract_bit_u8_UH1",4); -} -} - case 2: - model.sim = list("extract_bit_8_LH",4); - case 3: - switch (scal) { - case 0: - model.sim = list("extract_bit_8_MSB0",4); - case 1: - switch (Datatype) { - case 5: - model.sim = list("extract_bit_8_MSB1",4); - case 8: - model.sim = list("extract_bit_u8_MSB1",4); -} -} - case 4: - model.sim = list("extract_bit_8_LSB",4); - case 5: - switch (scal) { - case 0: - model.sim = list("extract_bit_8_RB0",4); - case 1: - switch (Datatype) { - case 5: - model.sim = list("extract_bit_8_RB1",4); - case 8: - model.sim = list("extract_bit_u8_RB1",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 = false; -} -} - if (ok) { - it = Datatype; - ot = Datatype; - out = [1,1]; - [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); -} - if (ok) { - graphics.exprs = exprs; - model.ipar = [[int(bit.slice())],[int(numb.slice())]]; - x.graphics = graphics; - x.model = model; -break; -} -} + [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) { + break; + } + bitstr = strcat(string(bit.slice())," "); + if ((rule<1)||(rule>5)) { + 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 = false; + } else if (scal<0||scal>1) { + 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 = false; + } else { + in1 = [model.in1,model.in2]; + bit = int(bit); + rule = int(rule); + if ((rule==3)||(rule==4)) { + if ((size(bit,"*")!=1)) { + 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 = false; + } else { + numb = bit; + } + } else if ((rule==5)) { + if ((size(bit,"*")!=2)) { + 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 = false; + } else if (bit[1-1]>bit[2-1]) { + 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 = false; + } else { + numb = bit[2-1]-bit[1-1]; + } + } else { + bit = 0; + numb = []; + } + } + if (ok) { + if ((Datatype==3||Datatype==6)) { + if (or(bit.slice()>31)||or(bit.slice()<0)) { + 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 = false; + } + switch (rule) { + case 1: + switch (scal) { + case 0: + model.sim = list("extract_bit_32_UH0",4); + case 1: + switch (Datatype) { + case 3: + model.sim = list("extract_bit_32_UH1",4); + case 6: + model.sim = list("extract_bit_u32_UH1",4); + } + } + case 2: + model.sim = list("extract_bit_32_LH",4); + case 3: + switch (scal) { + case 0: + model.sim = list("extract_bit_32_MSB0",4); + case 1: + switch (Datatype) { + case 3: + model.sim = list("extract_bit_32_MSB1",4); + case 6: + model.sim = list("extract_bit_u32_MSB1",4); + } + } + case 4: + model.sim = list("extract_bit_32_LSB",4); + case 5: + switch (scal) { + case 0: + model.sim = list("extract_bit_32_RB0",4); + case 1: + switch (Datatype) { + case 3: + model.sim = list("extract_bit_32_RB1",4); + case 6: + model.sim = list("extract_bit_u32_RB1",4); + } + } + } + } else if ((Datatype==4||Datatype==7)) { + if (or(bit.slice()>15)||or(bit.slice()<0)) { + 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 = false; + } + switch (rule) { + case 1: + switch (scal) { + case 0: + model.sim = list("extract_bit_16_UH0",4); + case 1: + switch (Datatype) { + case 4: + model.sim = list("extract_bit_16_UH1",4); + case 7: + model.sim = list("extract_bit_u16_UH1",4); + } + } + case 2: + model.sim = list("extract_bit_16_LH",4); + case 3: + switch (scal) { + case 0: + model.sim = list("extract_bit_16_MSB0",4); + case 1: + switch (Datatype) { + case 4: + model.sim = list("extract_bit_16_MSB1",4); + case 7: + model.sim = list("extract_bit_u16_MSB1",4); + } + } + case 4: + model.sim = list("extract_bit_16_LSB",4); + case 5: + switch (scal) { + case 0: + model.sim = list("extract_bit_16_RB0",4); + case 1: + switch (Datatype) { + case 4: + model.sim = list("extract_bit_16_RB1",4); + case 7: + model.sim = list("extract_bit_u16_RB1",4); + } + } + } + } else if ((Datatype==5||Datatype==8)) { + if (or(bit.slice()>7)||or(bit.slice()<0)) { + 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 = false; + } + switch (rule) { + case 1: + switch (scal) { + case 0: + model.sim = list("extract_bit_8_UH0",4); + case 1: + switch (Datatype) { + case 5: + model.sim = list("extract_bit_8_UH1",4); + case 8: + model.sim = list("extract_bit_u8_UH1",4); + } + } + case 2: + model.sim = list("extract_bit_8_LH",4); + case 3: + switch (scal) { + case 0: + model.sim = list("extract_bit_8_MSB0",4); + case 1: + switch (Datatype) { + case 5: + model.sim = list("extract_bit_8_MSB1",4); + case 8: + model.sim = list("extract_bit_u8_MSB1",4); + } + } + case 4: + model.sim = list("extract_bit_8_LSB",4); + case 5: + switch (scal) { + case 0: + model.sim = list("extract_bit_8_RB0",4); + case 1: + switch (Datatype) { + case 5: + model.sim = list("extract_bit_8_RB1",4); + case 8: + model.sim = list("extract_bit_u8_RB1",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 = false; + } + } + if (ok) { + it = Datatype; + ot = Datatype; + out = [1,1]; + [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); + } + if (ok) { + graphics.exprs = exprs; + model.ipar = [[int(bit.slice())],[int(numb.slice())]]; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/IntegerOp/EXTRACTBITS.pickle b/js/IntegerOp/EXTRACTBITS.pickle index 154645d8..0d1dde24 100644 --- a/js/IntegerOp/EXTRACTBITS.pickle +++ b/js/IntegerOp/EXTRACTBITS.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 .
\ No newline at end of file diff --git a/js/IntegerOp/INTMUL.js b/js/IntegerOp/INTMUL.js index 212da42a..95065dac 100644 --- a/js/IntegerOp/INTMUL.js +++ b/js/IntegerOp/INTMUL.js @@ -16,91 +16,92 @@ function INTMUL() { model.dep_ut = [true,false]; exprs = [[sci2exp(3)],[sci2exp(0)]]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } INTMUL.prototype.details = function INTMUL() { + return this.x; } INTMUL.prototype.get = function INTMUL() { } INTMUL.prototype.set = function INTMUL() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; model = arg1.model; exprs = graphics.exprs; while (true) { - [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) { -break; -} - it = Datatype*ones(1,2); - ot = Datatype; - if ((np!=0&&np!=1&&np!=2)) { -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 = false; - } else if (Datatype==3) { - if (np==0) { - model.sim = list("matmul_i32n",4); - } else if (np==1) { - model.sim = list("matmul_i32s",4); - } else { - model.sim = list("matmul_i32e",4); -} - } else if (Datatype==4) { - if (np==0) { - model.sim = list("matmul_i16n",4); - } else if (np==1) { - model.sim = list("matmul_i16s",4); - } else { - model.sim = list("matmul_i16e",4); -} - } else if (Datatype==5) { - if (np==0) { - model.sim = list("matmul_i8n",4); - } else if (np==1) { - model.sim = list("matmul_i8s",4); - } else { - model.sim = list("matmul_i8e",4); -} - } else if (Datatype==6) { - if (np==0) { - model.sim = list("matmul_ui32n",4); - } else if (np==1) { - model.sim = list("matmul_ui32s",4); - } else { - model.sim = list("matmul_ui32e",4); -} - } else if (Datatype==7) { - if (np==0) { - model.sim = list("matmul_ui16n",4); - } else if (np==1) { - model.sim = list("matmul_ui16s",4); - } else { - model.sim = list("matmul_ui16e",4); -} - } else if (Datatype==8) { - if (np==0) { - model.sim = list("matmul_ui8n",4); - } else if (np==1) { - model.sim = list("matmul_ui8s",4); - } else { - model.sim = list("matmul_ui8e",4); -} - } 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 = false; -} - in1 = [model.in1,model.in2]; - out = [model.out,model.out2]; - if (ok) { - [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); -} - if (ok) { - model.ipar = np; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [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) { + break; + } + it = Datatype*ones(1,2); + ot = Datatype; + if ((np!=0&&np!=1&&np!=2)) { + 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 = false; + } else if (Datatype==3) { + if (np==0) { + model.sim = list("matmul_i32n",4); + } else if (np==1) { + model.sim = list("matmul_i32s",4); + } else { + model.sim = list("matmul_i32e",4); + } + } else if (Datatype==4) { + if (np==0) { + model.sim = list("matmul_i16n",4); + } else if (np==1) { + model.sim = list("matmul_i16s",4); + } else { + model.sim = list("matmul_i16e",4); + } + } else if (Datatype==5) { + if (np==0) { + model.sim = list("matmul_i8n",4); + } else if (np==1) { + model.sim = list("matmul_i8s",4); + } else { + model.sim = list("matmul_i8e",4); + } + } else if (Datatype==6) { + if (np==0) { + model.sim = list("matmul_ui32n",4); + } else if (np==1) { + model.sim = list("matmul_ui32s",4); + } else { + model.sim = list("matmul_ui32e",4); + } + } else if (Datatype==7) { + if (np==0) { + model.sim = list("matmul_ui16n",4); + } else if (np==1) { + model.sim = list("matmul_ui16s",4); + } else { + model.sim = list("matmul_ui16e",4); + } + } else if (Datatype==8) { + if (np==0) { + model.sim = list("matmul_ui8n",4); + } else if (np==1) { + model.sim = list("matmul_ui8s",4); + } else { + model.sim = list("matmul_ui8e",4); + } + } 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 = false; + } + in1 = [model.in1,model.in2]; + out = [model.out,model.out2]; + if (ok) { + [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); + } + if (ok) { + model.ipar = np; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/IntegerOp/INTMUL.pickle b/js/IntegerOp/INTMUL.pickle index 154645d8..0d1dde24 100644 --- a/js/IntegerOp/INTMUL.pickle +++ b/js/IntegerOp/INTMUL.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 .
\ No newline at end of file diff --git a/js/IntegerOp/JKFLIPFLOP.js b/js/IntegerOp/JKFLIPFLOP.js index c85d2328..3ee2ab1f 100644 --- a/js/IntegerOp/JKFLIPFLOP.js +++ b/js/IntegerOp/JKFLIPFLOP.js @@ -45,49 +45,50 @@ function JKFLIPFLOP() { model.dep_ut = [true,false]; model.rpar = scs_m; gr_i = []; - x = standard_define([2,3],model,[],gr_i); + this.x = standard_define([2,3],model,[],gr_i); } JKFLIPFLOP.prototype.details = function JKFLIPFLOP() { + return this.x; } JKFLIPFLOP.prototype.get = function JKFLIPFLOP() { } JKFLIPFLOP.prototype.set = function JKFLIPFLOP() { -for (i=1;i<=length(arg1.model.rpar.objs);i+=1) { - o = arg1.model.rpar.objs[i-1]; - if (typeof(o)=="Block"&&o.gui=="DOLLAR_m") { - path = i; -break; -} -} + for (i=1;i<=length(arg1.model.rpar.objs);i+=1) { + o = arg1.model.rpar.objs[i-1]; + if (typeof(o)=="Block"&&o.gui=="DOLLAR_m") { + path = i; + break; + } + } newpar = list(); xx = arg1.model.rpar.objs[path-1]; exprs = xx.graphics.exprs[1-1]; model = xx.model; init_old = model.odstate[1-1]; while (true) { - [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) { -break; -} - if (init<=0) { - init = int8(0); - } else if (init>0) { - init = int8(1); -} - if (ok) { - xx.graphics.exprs[1-1] = exprs0; - model.odstate[1-1] = init; - xx.model = model; - arg1.model.rpar.objs[path-1] = xx; -break; -} -} + [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) { + break; + } + if (init<=0) { + init = int8(0); + } else if (init>0) { + init = int8(1); + } + if (ok) { + xx.graphics.exprs[1-1] = exprs0; + model.odstate[1-1] = init; + xx.model = model; + arg1.model.rpar.objs[path-1] = xx; + break; + } + } needcompile = 0; if (init_old!=init) { - newpar[size(newpar)+1-1] = 1; - needcompile = 2; -} - x = arg1; + newpar[size(newpar)+1-1] = 1; + needcompile = 2; + } + this.x = arg1; y = needcompile; typ = newpar; } diff --git a/js/IntegerOp/JKFLIPFLOP.pickle b/js/IntegerOp/JKFLIPFLOP.pickle index 154645d8..0d1dde24 100644 --- a/js/IntegerOp/JKFLIPFLOP.pickle +++ b/js/IntegerOp/JKFLIPFLOP.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 .
\ No newline at end of file diff --git a/js/IntegerOp/LOGIC.js b/js/IntegerOp/LOGIC.js index ae5dff86..d4ebdf7c 100644 --- a/js/IntegerOp/LOGIC.js +++ b/js/IntegerOp/LOGIC.js @@ -17,50 +17,51 @@ function LOGIC() { model.dep_ut = [true,false]; exprs = [[sci2exp(mat)],[sci2exp(0)]]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } LOGIC.prototype.details = function LOGIC() { + return this.x; } LOGIC.prototype.get = function LOGIC() { } LOGIC.prototype.set = function LOGIC() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [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) { -break; -} - nout = size(mat,2); - nin = (log(size(mat,1))/log(2)); - u1 = floor(nin); - if ((u1!=nin)) { -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 = false; - } else if ((find(mat.slice()!=0&&mat.slice()!=1)!=[])) { -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 = false; - } else if (herit<0||herit>1) { -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 = false; -} - if (ok) { - in1 = [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(in1,it),list(out,ot),ones(1-herit,1),[]); -} - if (ok) { - graphics.exprs = exprs; - mat = int8(mat); - model.opar = list(mat); - x.graphics = graphics; - x.model = model; -break; -} -} + [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) { + break; + } + nout = size(mat,2); + nin = (log(size(mat,1))/log(2)); + u1 = floor(nin); + if ((u1!=nin)) { + 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 = false; + } else if ((find(mat.slice()!=0&&mat.slice()!=1)!=[])) { + 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 = false; + } else if (herit<0||herit>1) { + 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 = false; + } + if (ok) { + in1 = [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(in1,it),list(out,ot),ones(1-herit,1),[]); + } + if (ok) { + graphics.exprs = exprs; + mat = int8(mat); + model.opar = list(mat); + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/IntegerOp/LOGIC.pickle b/js/IntegerOp/LOGIC.pickle index 154645d8..0d1dde24 100644 --- a/js/IntegerOp/LOGIC.pickle +++ b/js/IntegerOp/LOGIC.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 .
\ No newline at end of file diff --git a/js/IntegerOp/SHIFT.js b/js/IntegerOp/SHIFT.js index 0f51c315..55af03ed 100644 --- a/js/IntegerOp/SHIFT.js +++ b/js/IntegerOp/SHIFT.js @@ -17,105 +17,106 @@ function SHIFT() { model.dep_ut = [true,false]; exprs = [[sci2exp(3)],[sci2exp(0)],[sci2exp(0)]]; gr_i = []; - x = standard_define([3,2],model,exprs,gr_i); + this.x = standard_define([3,2],model,exprs,gr_i); } SHIFT.prototype.details = function SHIFT() { + return this.x; } SHIFT.prototype.get = function SHIFT() { } SHIFT.prototype.set = function SHIFT() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; model = arg1.model; exprs = graphics.exprs; while (true) { - [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) { -break; -} - if ((np!=0&&np!=1)) { -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 = false; -} - it = Datatype; - ot = Datatype; - if ((Datatype==3||Datatype==6)) { - if (nb>0) { - switch (np) { - case 0: - model.sim = list("shift_32_LA",4); - case 1: - model.sim = list("shift_32_LC",4); -} - } else if (nb<0) { - switch (np) { - case 0: - switch (Datatype) { - case 3: - model.sim = list("shift_32_RA",4); - case 6: - model.sim = list("shift_u32_RA",4); -} - case 1: - model.sim = list("shift_32_RC",4); -} -} - } else if ((Datatype==4||Datatype==7)) { - if (nb>0) { - switch (np) { - case 0: - model.sim = list("shift_16_LA",4); - case 1: - model.sim = list("shift_16_LC",4); -} - } else if (nb<0) { - switch (np) { - case 0: - switch (Datatype) { - case 4: - model.sim = list("shift_16_RA",4); - case 7: - model.sim = list("shift_u16_RA",4); -} - case 1: - model.sim = list("shift_16_RC",4); -} -} - } else if ((Datatype==5||Datatype==8)) { - if (nb>0) { - switch (np) { - case 0: - model.sim = list("shift_8_LA",4); - case 1: - model.sim = list("shift_8_LC",4); -} - } else if (nb<0) { - switch (np) { - case 0: - switch (Datatype) { - case 5: - model.sim = list("shift_8_RA",4); - case 8: - model.sim = list("shift_u8_RA",4); -} - case 1: - model.sim = list("shift_8_RC",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 = false; -} - if (ok) { - [model,graphics,ok] = set_io(model,graphics,list([-1,-2],it),list([-1,-2],ot),[],[]); -} - if (ok) { - model.ipar = nb; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [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) { + break; + } + if ((np!=0&&np!=1)) { + 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 = false; + } + it = Datatype; + ot = Datatype; + if ((Datatype==3||Datatype==6)) { + if (nb>0) { + switch (np) { + case 0: + model.sim = list("shift_32_LA",4); + case 1: + model.sim = list("shift_32_LC",4); + } + } else if (nb<0) { + switch (np) { + case 0: + switch (Datatype) { + case 3: + model.sim = list("shift_32_RA",4); + case 6: + model.sim = list("shift_u32_RA",4); + } + case 1: + model.sim = list("shift_32_RC",4); + } + } + } else if ((Datatype==4||Datatype==7)) { + if (nb>0) { + switch (np) { + case 0: + model.sim = list("shift_16_LA",4); + case 1: + model.sim = list("shift_16_LC",4); + } + } else if (nb<0) { + switch (np) { + case 0: + switch (Datatype) { + case 4: + model.sim = list("shift_16_RA",4); + case 7: + model.sim = list("shift_u16_RA",4); + } + case 1: + model.sim = list("shift_16_RC",4); + } + } + } else if ((Datatype==5||Datatype==8)) { + if (nb>0) { + switch (np) { + case 0: + model.sim = list("shift_8_LA",4); + case 1: + model.sim = list("shift_8_LC",4); + } + } else if (nb<0) { + switch (np) { + case 0: + switch (Datatype) { + case 5: + model.sim = list("shift_8_RA",4); + case 8: + model.sim = list("shift_u8_RA",4); + } + case 1: + model.sim = list("shift_8_RC",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 = false; + } + if (ok) { + [model,graphics,ok] = set_io(model,graphics,list([-1,-2],it),list([-1,-2],ot),[],[]); + } + if (ok) { + model.ipar = nb; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/IntegerOp/SHIFT.pickle b/js/IntegerOp/SHIFT.pickle index 154645d8..0d1dde24 100644 --- a/js/IntegerOp/SHIFT.pickle +++ b/js/IntegerOp/SHIFT.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 .
\ No newline at end of file diff --git a/js/IntegerOp/SRFLIPFLOP.js b/js/IntegerOp/SRFLIPFLOP.js index 4403dd70..d5db4b00 100644 --- a/js/IntegerOp/SRFLIPFLOP.js +++ b/js/IntegerOp/SRFLIPFLOP.js @@ -29,49 +29,50 @@ function SRFLIPFLOP() { model.dep_ut = [true,false]; model.rpar = scs_m; gr_i = []; - x = standard_define([2,3],model,[],gr_i); + this.x = standard_define([2,3],model,[],gr_i); } SRFLIPFLOP.prototype.details = function SRFLIPFLOP() { + return this.x; } SRFLIPFLOP.prototype.get = function SRFLIPFLOP() { } SRFLIPFLOP.prototype.set = function SRFLIPFLOP() { -for (i=1;i<=length(arg1.model.rpar.objs);i+=1) { - o = arg1.model.rpar.objs[i-1]; - if (typeof(o)=="Block"&&o.gui=="DOLLAR_m") { - path = i; -break; -} -} + for (i=1;i<=length(arg1.model.rpar.objs);i+=1) { + o = arg1.model.rpar.objs[i-1]; + if (typeof(o)=="Block"&&o.gui=="DOLLAR_m") { + path = i; + break; + } + } newpar = list(); xx = arg1.model.rpar.objs[path-1]; exprs = xx.graphics.exprs[1-1]; model = xx.model; init_old = model.odstate[1-1]; while (true) { - [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) { -break; -} - if (init<=0) { - init = int8(0); - } else if (init>0) { - init = int8(1); -} - if (ok) { - xx.graphics.exprs[1-1] = exprs0; - model.odstate[1-1] = init; - xx.model = model; - arg1.model.rpar.objs[path-1] = xx; -break; -} -} + [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) { + break; + } + if (init<=0) { + init = int8(0); + } else if (init>0) { + init = int8(1); + } + if (ok) { + xx.graphics.exprs[1-1] = exprs0; + model.odstate[1-1] = init; + xx.model = model; + arg1.model.rpar.objs[path-1] = xx; + break; + } + } needcompile = 0; if (init_old!=init) { - newpar[size(newpar)+1-1] = path; - needcompile = 2; -} - x = arg1; + newpar[size(newpar)+1-1] = path; + needcompile = 2; + } + this.x = arg1; y = needcompile; typ = newpar; } diff --git a/js/IntegerOp/SRFLIPFLOP.pickle b/js/IntegerOp/SRFLIPFLOP.pickle index 154645d8..0d1dde24 100644 --- a/js/IntegerOp/SRFLIPFLOP.pickle +++ b/js/IntegerOp/SRFLIPFLOP.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 .
\ No newline at end of file |