/* autogenerated from "macros/IntegerOp/LOGIC.sci" */ function LOGIC() { LOGIC.prototype.define = function LOGIC() { this.mat = [[0],[0],[0],[1]]; this.model = scicos_model(); this.model.sim = list(new ScilabString(["logic"]), new ScilabDouble([4])); this.model.in1 = [[1],[1]]; this.model.in2 = [[1],[1]]; this.model.out = new ScilabDouble([1]); this.model.out2 = new ScilabDouble([1]); this.model.evtin = new ScilabDouble([1]); this.model.intyp = [5,5]; this.model.outtyp = new ScilabDouble([5]); this.model.opar = list(new ScilabDouble([int8(this.mat)])); this.model.blocktype = new ScilabString(["c"]); this.model.firing = new ScilabBoolean([false]); this.model.dep_ut = [true,false]; exprs = [[sci2exp(this.mat)],[sci2exp(0)]]; gr_i = []; this.x = standard_define([2,2],this.model,exprs,gr_i); return new BasicBlock(this.x); } LOGIC.prototype.details = function LOGIC() { return this.x; } LOGIC.prototype.get = function LOGIC() { var options = { mat:["Truth Table (matrix of outputs)",this.mat.toString().replace(/,/g," ")], herit:["Accepts Inherited Events (0:No, 1:Yes)",this.herit], } return options; } LOGIC.prototype.set = function LOGIC() { this.mat = inverse(arguments[0]["mat"]) this.herit = arguments[0]["herit"] this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; this.model = arg1.model; while (true) { [ok,this.mat,this.herit,exprs] = scicos_getvalue([[msprintf("Set %s block parameters","LOGIC")],[" "],["Combinatorial logic"],[" "],["  Rows of the matrix are the output values"],["  Number of rows must be a power of two."],["  Number of columns gives the number of outputs."],[" "]],["Truth Table (matrix of outputs)","Accepts Inherited Events (0:No, 1:Yes)"],list("mat",[-1,-2],"vec",1),exprs); if (!ok) { break; } nout = size(this.mat,2); nin = (log(size(this.mat,1))/log(2)); u1 = floor(nin); if ((u1!=nin)) { block_parameter_error(msprintf("Wrong size for \'%s\' parameter: %d.","Truth Table",size(this.mat,1)),"Number of rows must be a power of two."); ok = false; } else if ((find(this.mat.slice()!=0&&this.mat.slice()!=1)!=[])) { block_parameter_error(msprintf("Wrong value for \'%s\' parameter.","Truth Table"),msprintf("Elements must be in the interval %s.","[0, 1]")); ok = false; } else if (this.herit<0||this.herit>1) { block_parameter_error(msprintf("Wrong value for \'%s\' parameter: %d.","Accepts Inherited Events",this.herit),msprintf("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(this.model,graphics,list(in1,it),list(out,ot),ones(1-this.herit,1),[]); } if (ok) { graphics.exprs = exprs; this.mat = int8(this.mat); this.model.opar = list(new ScilabDouble([this.mat])); this.x.graphics = graphics; this.x.model = this.model; break; } } return new BasicBlock(this.x); } }