Skip to content

Commit

Permalink
Add asynchronous Dff loading to support Yosys 0.11
Browse files Browse the repository at this point in the history
  • Loading branch information
tilk committed Dec 22, 2021
1 parent c6d453b commit 4af8b58
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ All notable changes to this project will be documented in this file.

## [Unreleased]

### Added
- The `Dff` block can now have asynchronous loading.

### Changed
- The `elkjs` layout engine now includes laying out edges via adding bend points. The SPOrE algorithm was disabled because it did not work well with the change. (Contributor: Yichao Yu)

Expand Down
7 changes: 7 additions & 0 deletions src/cells/dff.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ export const Dff = Box.define('Dff', {
this.set('srst_value', Array(bits).fill('0').join(''));

let num = 1;
if ('aload' in polarity) {
num += 2;
ports.push({ id: 'ain', group: 'in', dir: 'in', bits: bits, portlabel: 'AD', labelled: true });
ports.push({ id: 'aload', group: 'in', dir: 'in', bits: 1, polarity: polarity.aload, labelled: true });
}
if ('clock' in polarity) {
num++;
ports.push({ id: 'clk', group: 'in', dir: 'in', bits: 1, polarity: polarity.clock, decor: Box.prototype.decorClock, labelled: true });
Expand Down Expand Up @@ -88,6 +93,8 @@ export const Dff = Box.define('Dff', {
}
if ('arst' in polarity && data.arst.get(0) == pol('arst'))
return { out: Vector3vl.fromBin(this.get('arst_value'), this.get('bits')) };
if ('aload' in polarity && data.aload.get(0) == pol('aload'))
return { out: data.ain };
if ('set' in polarity) {
srbits = polarity.set ? data.set : data.set.not();
srbitmask = polarity.set ? data.set.not() : data.set;
Expand Down

0 comments on commit 4af8b58

Please sign in to comment.