// 74xx02 emulation component for the LogicSimulator // Copyright (C) 2022 Sascha Nitsch // 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 3 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, see . // eslint-disable-next-line @typescript-eslint/no-unused-vars function IC74xx02Init() { class IC74xx02 extends DILBase { constructor(simulator: Simulator, id: string, param: BaseComponentParam) { super(simulator, id, 14, param); } setup(canvas: SVGElement) { super.DILBASEsetup('ic14', canvas, '74xx02'); } update(): boolean { if (this.startdelay) { --this.startdelay; return false; } if (this.getStateWire('p14') !== WireState.high || this.getStateWire('p7') !== WireState.low) return false; // no power let oldstate; let mod = false; let s; oldstate = this.getStateWire('p1'); s = !( this.binary(this.getStateWire('p2'), true) !== false || this.binary(this.getStateWire('p3'), true) !== false ); this.stateMapWire.set('p1', s ? WireState.high : WireState.low); mod ||= this.getStateWire('p1') !== oldstate; oldstate = this.getStateWire('p4'); s = !( this.binary(this.getStateWire('p5'), true) !== false || this.binary(this.getStateWire('p6'), true) !== false ); this.stateMapWire.set('p4', s ? WireState.high : WireState.low); mod ||= this.getStateWire('p4') !== oldstate; oldstate = this.getStateWire('p10'); s = !( this.binary(this.getStateWire('p8'), true) !== false || this.binary(this.getStateWire('p9'), true) !== false ); this.stateMapWire.set('p10', s ? WireState.high : WireState.low); mod ||= this.getStateWire('p10') !== oldstate; oldstate = this.getStateWire('p13'); s = !( this.binary(this.getStateWire('p11'), true) !== false || this.binary(this.getStateWire('p12'), true) !== false ); this.stateMapWire.set('p13', s ? WireState.high : WireState.low); mod ||= this.getStateWire('p13') !== oldstate; this.getPin('p1').setState(this.getStateWire('p1')); this.getPin('p4').setState(this.getStateWire('p4')); this.getPin('p10').setState(this.getStateWire('p10')); this.getPin('p13').setState(this.getStateWire('p13')); return mod; } } window.IC74xx02 = IC74xx02; } // eslint-disable-next-line @typescript-eslint/no-unused-vars function IC74xx02Depends() { return 'dilbase'; }