How to use the 3vl.Vector3vl.make function in 3vl

To help you get started, we’ve selected a few 3vl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tilk / digitaljs / src / cells / bus.js View on Github external
operation: function(data) {
        const ex = this.get('extend');
        return { out: data.in.concat(Vector3vl.make(ex.output - ex.input, this.extbit(data.in))) };
    },
    gateParams: Gate.prototype.gateParams.concat(['extend'])
github tilk / digitaljs / src / cells / arith.js View on Github external
operation: function(data) {
        const bits = this.get('bits');
        const sgn = this.get('signed');
        const fillx = this.get('fillx');
        if (!data.in2.isFullyDefined)
            return { out: Vector3vl.xes(bits.out) };
        const am = help.sig2bigint(data.in2, sgn.in2) * this.shiftdir;
        const signbit = data.in1.get(data.in1.bits-1);
        const ext = Vector3vl.make(Math.max(0, bits.out - bits.in1),
            fillx ? 0 : sgn.in1 ? signbit : -1);
        const my_in = data.in1.concat(ext);
        const out = am < 0
            ? Vector3vl.make(-am, fillx ? 0 : -1).concat(my_in)
            : my_in.slice(am).concat(Vector3vl.make(am, fillx ? 0 : sgn.out ? my_in.get(my_in.bits-1) : -1));
        return { out: out.slice(0, bits.out) };
    },
    gateParams: Gate.prototype.gateParams.concat(['bits', 'signed', 'fillx'])
github tilk / digitaljs / src / cells / arith.js View on Github external
operation: function(data) {
        const bits = this.get('bits');
        const sgn = this.get('signed');
        const fillx = this.get('fillx');
        if (!data.in2.isFullyDefined)
            return { out: Vector3vl.xes(bits.out) };
        const am = help.sig2bigint(data.in2, sgn.in2) * this.shiftdir;
        const signbit = data.in1.get(data.in1.bits-1);
        const ext = Vector3vl.make(Math.max(0, bits.out - bits.in1),
            fillx ? 0 : sgn.in1 ? signbit : -1);
        const my_in = data.in1.concat(ext);
        const out = am < 0
            ? Vector3vl.make(-am, fillx ? 0 : -1).concat(my_in)
            : my_in.slice(am).concat(Vector3vl.make(am, fillx ? 0 : sgn.out ? my_in.get(my_in.bits-1) : -1));
        return { out: out.slice(0, bits.out) };
    },
    gateParams: Gate.prototype.gateParams.concat(['bits', 'signed', 'fillx'])
github tilk / digitaljs / src / cells / arith.js View on Github external
operation: function(data) {
        const bits = this.get('bits');
        const sgn = this.get('signed');
        const fillx = this.get('fillx');
        if (!data.in2.isFullyDefined)
            return { out: Vector3vl.xes(bits.out) };
        const am = help.sig2bigint(data.in2, sgn.in2) * this.shiftdir;
        const signbit = data.in1.get(data.in1.bits-1);
        const ext = Vector3vl.make(Math.max(0, bits.out - bits.in1),
            fillx ? 0 : sgn.in1 ? signbit : -1);
        const my_in = data.in1.concat(ext);
        const out = am < 0
            ? Vector3vl.make(-am, fillx ? 0 : -1).concat(my_in)
            : my_in.slice(am).concat(Vector3vl.make(am, fillx ? 0 : sgn.out ? my_in.get(my_in.bits-1) : -1));
        return { out: out.slice(0, bits.out) };
    },
    gateParams: Gate.prototype.gateParams.concat(['bits', 'signed', 'fillx'])