diff --git a/src/cells/base.mjs b/src/cells/base.mjs index 944237a..e0eebc9 100644 --- a/src/cells/base.mjs +++ b/src/cells/base.mjs @@ -298,7 +298,8 @@ export const Gate = joint.dia.Element.define('Gate', { _gateLayoutParams: ['position'], _unsupportedPropChanges: [], _operationHelpers: [], - _presentationParams: [] + _presentationParams: [], + _gateKind: 'combinational' }); export const GateView = joint.dia.ElementView.extend({ diff --git a/src/cells/bus.mjs b/src/cells/bus.mjs index 6c5169a..0664fc6 100644 --- a/src/cells/bus.mjs +++ b/src/cells/bus.mjs @@ -41,7 +41,8 @@ export const BitExtend = Box.define('BitExtend', { } ]), _gateParams: Box.prototype._gateParams.concat(['extend']), - _operationHelpers: Box.prototype._operationHelpers.concat(['_extBit']) + _operationHelpers: Box.prototype._operationHelpers.concat(['_extBit']), + _gateKind: 'bus' }); export const BitExtendView = BoxView.extend({ _autoResizeBox: true, @@ -102,7 +103,8 @@ export const BusSlice = Box.define('BusSlice', { const s = this.get('slice'); return { out: data.in.slice(s.first, s.first + s.count) }; }, - _gateParams: Box.prototype._gateParams.concat(['slice']) + _gateParams: Box.prototype._gateParams.concat(['slice']), + _gateKind: 'bus' }); export const BusSliceView = BoxView.extend({ _autoResizeBox: true @@ -137,7 +139,8 @@ export const BusRegroup = Box.define('BusRegroup', { Box.prototype.initialize.apply(this, arguments); }, _gateParams: Box.prototype._gateParams.concat(['groups']), - _unsupportedPropChanges: Box.prototype._unsupportedPropChanges.concat(['groups']) + _unsupportedPropChanges: Box.prototype._unsupportedPropChanges.concat(['groups']), + _gateKind: 'bus' }); export const BusRegroupView = BoxView.extend({ _autoResizeBox: true diff --git a/src/cells/dff.mjs b/src/cells/dff.mjs index f908f4d..92dc8b8 100644 --- a/src/cells/dff.mjs +++ b/src/cells/dff.mjs @@ -115,7 +115,8 @@ export const Dff = Box.define('Dff', { } else return apply_sr(this.get('outputSignals').out); }, _gateParams: Box.prototype._gateParams.concat(['polarity', 'bits', 'initial', 'arst_value', 'srst_value', 'enable_srst', 'no_data']), - _unsupportedPropChanges: Box.prototype._unsupportedPropChanges.concat(['polarity', 'bits', 'initial', 'arst_value', 'srst_value', 'enable_srst', 'no_data']) + _unsupportedPropChanges: Box.prototype._unsupportedPropChanges.concat(['polarity', 'bits', 'initial', 'arst_value', 'srst_value', 'enable_srst', 'no_data']), + _gateKind: 'stateful' }); export const DffView = BoxView.extend({ _autoResizeBox: true diff --git a/src/cells/fsm.mjs b/src/cells/fsm.mjs index f1d502b..78a39e8 100644 --- a/src/cells/fsm.mjs +++ b/src/cells/fsm.mjs @@ -178,7 +178,8 @@ export const FSM = Box.define('FSM', { markup: Box.prototype.markup.concat(Box.prototype.markupZoom), _gateParams: Box.prototype._gateParams.concat(['bits', 'polarity', 'states', 'init_state', 'trans_table']), _unsupportedPropChanges: Box.prototype._unsupportedPropChanges.concat(['bits', 'polarity', 'states', 'init_state', 'trans_table']), - _presentationParams: Box.prototype._presentationParams.concat(['current_state', 'next_trans']) + _presentationParams: Box.prototype._presentationParams.concat(['current_state', 'next_trans']), + _gateKind: 'stateful' }); export const FSMView = BoxView.extend({ diff --git a/src/cells/memory.mjs b/src/cells/memory.mjs index fce4f24..fb7f101 100644 --- a/src/cells/memory.mjs +++ b/src/cells/memory.mjs @@ -257,7 +257,8 @@ export const Memory = Box.define('Memory', { }, _gateParams: Box.prototype._gateParams.concat(['bits', 'abits', 'rdports', 'wrports', 'words', 'offset']), _unsupportedPropChanges: Box.prototype._unsupportedPropChanges.concat(['bits', 'abits', 'rdports', 'wrports', 'words', 'offset']), - _operationHelpers: Box.prototype._operationHelpers.concat(['_memrdports', '_memwrports', '_memports', '_calcaddr']) + _operationHelpers: Box.prototype._operationHelpers.concat(['_memrdports', '_memwrports', '_memports', '_calcaddr']), + _gateKind: 'stateful' }); export const MemoryView = BoxView.extend({ _autoResizeBox: true, diff --git a/src/circuit.mjs b/src/circuit.mjs index 90c7c08..0692a9d 100644 --- a/src/circuit.mjs +++ b/src/circuit.mjs @@ -70,8 +70,9 @@ export function getCellType(tp) { } export class HeadlessCircuit { - constructor(data, {cellsNamespace = {}, engine = SynchEngine, engineOptions = {}} = {}) { + constructor(data, {cellsNamespace = {}, engine = SynchEngine, engineOptions = {}, defaultCombinationalPropagation} = {}) { this._cells = Object.assign(cells, cellsNamespace); + this._defaultCombinationalPropagation = defaultCombinationalPropagation; this._display3vl = new Display3vl(); this._display3vl.addDisplay(new help.Display3vlASCII()); this._graph = this._makeGraph(data, data.subcircuits); @@ -161,6 +162,8 @@ export class HeadlessCircuit { cellArgs.id = devid; if (cellType == this._cells.Subcircuit) cellArgs.graph = this._makeGraph(subcircuits[dev.celltype], subcircuits, { nested: true }); + if (this._defaultCombinationalPropagation !== undefined && !('propagation' in cellArgs) && cellType.prototype._gateKind == 'combinational') + cellArgs.propagation = this._defaultCombinationalPropagation; const cell = new cellType(cellArgs); graph.addCell(cell); }