Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: tilk/digitaljs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0.0.6
Choose a base ref
...
head repository: tilk/digitaljs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref

Commits on Aug 30, 2018

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    c891a6d View commit details

Commits on Sep 6, 2018

  1. More TODO.

    tilk committed Sep 6, 2018
    Copy the full SHA
    fc32697 View commit details
  2. Additional tests.

    tilk committed Sep 6, 2018
    Copy the full SHA
    4b9f835 View commit details
  3. Copy the full SHA
    6ee0418 View commit details

Commits on Sep 11, 2018

  1. Fixed nor gate.

    tilk committed Sep 11, 2018
    Copy the full SHA
    e6d182e View commit details
  2. Start test suite.

    tilk committed Sep 11, 2018
    Copy the full SHA
    99ec40f View commit details
  3. Nicer testing using generators.

    tilk committed Sep 11, 2018
    Copy the full SHA
    31077fa View commit details
  4. Randomized testing.

    tilk committed Sep 11, 2018
    Copy the full SHA
    c9fcc89 View commit details
  5. Copy the full SHA
    8698e24 View commit details
  6. Copy the full SHA
    f4fe7ee View commit details
  7. Test for muxes.

    tilk committed Sep 11, 2018
    Copy the full SHA
    7c98da9 View commit details
  8. Towards testing arithmetic.

    tilk committed Sep 11, 2018
    Copy the full SHA
    b6b80f2 View commit details

Commits on Sep 15, 2018

  1. New TODO point.

    tilk committed Sep 15, 2018
    Copy the full SHA
    a9bc8ad View commit details
  2. Fix.

    tilk committed Sep 15, 2018
    Copy the full SHA
    5975613 View commit details
  3. Testing signed compare.

    tilk committed Sep 15, 2018
    Copy the full SHA
    c8185a9 View commit details

Commits on Sep 16, 2018

  1. Test all comparison operators.

    tilk committed Sep 16, 2018
    Copy the full SHA
    cdd10cf View commit details
  2. Fix.

    tilk committed Sep 16, 2018
    Copy the full SHA
    1ecf7ad View commit details
  3. Copy the full SHA
    1cd5431 View commit details

Commits on Sep 17, 2018

  1. Fix fix.

    tilk committed Sep 17, 2018
    Copy the full SHA
    d792c7d View commit details
  2. More arith tests.

    tilk committed Sep 17, 2018
    Copy the full SHA
    ba05c01 View commit details

Commits on Sep 18, 2018

  1. Copy the full SHA
    e56ca9f View commit details
  2. Copy the full SHA
    f3ea7a1 View commit details
  3. Copy the full SHA
    b190e10 View commit details
  4. Simple test for $constant.

    tilk committed Sep 18, 2018
    Copy the full SHA
    58335e5 View commit details
  5. Basic bitshift tests.

    tilk committed Sep 18, 2018
    Copy the full SHA
    902ff4c View commit details
  6. Fix.

    tilk committed Sep 18, 2018
    Copy the full SHA
    def6623 View commit details
  7. Better arith/shift testing.

    tilk committed Sep 18, 2018
    Copy the full SHA
    f7bb199 View commit details

Commits on Sep 19, 2018

  1. Fix.

    tilk committed Sep 19, 2018
    Copy the full SHA
    793179f View commit details
  2. Copy the full SHA
    449ba1c View commit details
  3. Added test for busslice.

    tilk committed Sep 19, 2018
    Copy the full SHA
    2d72a19 View commit details
  4. Copy the full SHA
    d9bb0f8 View commit details
  5. Copy the full SHA
    e651c21 View commit details
  6. Added schematic export.

    tilk committed Sep 19, 2018
    Copy the full SHA
    af7c249 View commit details

Commits on Sep 21, 2018

  1. Changes for better UI.

    tilk committed Sep 21, 2018
    Copy the full SHA
    f8c3dc9 View commit details
  2. Copy the full SHA
    b726ba5 View commit details

Commits on Sep 24, 2018

  1. Bump version number.

    tilk committed Sep 24, 2018
    Copy the full SHA
    c7caef5 View commit details
  2. Added logo.

    tilk committed Sep 24, 2018
    Copy the full SHA
    6b6508c View commit details
  3. README.md: add link to web app

    tilk authored Sep 24, 2018
    Copy the full SHA
    a6ca55e View commit details

Commits on Sep 25, 2018

  1. Update README.md

    tilk authored Sep 25, 2018
    Copy the full SHA
    8fbc97a View commit details
  2. Copy the full SHA
    5a3ac01 View commit details
  3. Fixed example.

    tilk committed Sep 25, 2018
    Copy the full SHA
    3cfd852 View commit details
  4. Copy the full SHA
    f2a247b View commit details

Commits on Oct 2, 2018

  1. Copy the full SHA
    18600e9 View commit details
  2. Copy the full SHA
    71e4cf7 View commit details
  3. Bump version number.

    tilk committed Oct 2, 2018
    Copy the full SHA
    284b4e9 View commit details
  4. Copy the full SHA
    bb0abe2 View commit details

Commits on Oct 3, 2018

  1. Added decimal base.

    tilk committed Oct 3, 2018
    Copy the full SHA
    78ea79b View commit details
  2. New TODO position.

    tilk committed Oct 3, 2018
    Copy the full SHA
    a144eaf View commit details

Commits on Oct 17, 2018

  1. Towards signal monitor.

    tilk committed Oct 17, 2018
    Copy the full SHA
    ab79d81 View commit details

Commits on Oct 19, 2018

  1. Styles for monitor.

    tilk committed Oct 19, 2018
    Copy the full SHA
    cc9aea7 View commit details
Showing with 52,973 additions and 158,575 deletions.
  1. +13 −0 .babelrc
  2. +1 −0 .github/FUNDING.yml
  3. +67 −0 .github/workflows/codeql-analysis.yml
  4. +29 −0 .github/workflows/nodejs.yml
  5. +1 −0 .gitignore
  6. +0 −3 .travis.yml
  7. +68 −0 ChangeLog.md
  8. +141 −10 README.md
  9. +15 −0 babel.config.json
  10. +187 −0 docs/resources/digitaljs_text_right.svg
  11. +217 −0 docs/resources/digitaljs_textpath_right.svg
  12. +81 −0 examples/arithconst.json
  13. +247 −0 examples/biggate.json
  14. +10 −10 {src/test → examples}/cycleadder.json
  15. +343 −0 examples/fsm.json
  16. +14 −12 {src/test → examples}/fulladder.json
  17. +406 −0 examples/gates.json
  18. +1 −0 examples/horner.json
  19. +119 −0 examples/io.json
  20. +37 −0 examples/latch.json
  21. +9 −9 {src/test → examples}/lfsr.json
  22. +81 −0 examples/muxsparse.json
  23. +132 −0 examples/ram.json
  24. +73 −0 examples/rom.json
  25. +31 −25 {src/test → examples}/serialadder.json
  26. +19,484 −0 examples/sextium.json
  27. +86 −0 examples/template.html
  28. +134 −0 examples/warnings.json
  29. +23,435 −4,374 package-lock.json
  30. +66 −21 package.json
  31. +0 −12 src/cells.js
  32. +13 −0 src/cells.mjs
  33. +0 −308 src/cells/arith.js
  34. +646 −0 src/cells/arith.mjs
  35. +0 −315 src/cells/base.js
  36. +719 −0 src/cells/base.mjs
  37. +0 −135 src/cells/bus.js
  38. +175 −0 src/cells/bus.mjs
  39. +0 −51 src/cells/dff.js
  40. +125 −0 src/cells/dff.mjs
  41. +130 −0 src/cells/display7.mjs
  42. +228 −0 src/cells/fsm.mjs
  43. +0 −125 src/cells/gate-and.svg
  44. +0 −131 src/cells/gate-nand.svg
  45. +0 −142 src/cells/gate-nor.svg
  46. +0 −139 src/cells/gate-not.svg
  47. +0 −135 src/cells/gate-or.svg
  48. +0 −132 src/cells/gate-repeater.svg
  49. +0 −147 src/cells/gate-xnor.svg
  50. +0 −141 src/cells/gate-xor.svg
  51. +0 −198 src/cells/gates.js
  52. +318 −0 src/cells/gates.mjs
  53. +0 −346 src/cells/io.js
  54. +521 −0 src/cells/io.mjs
  55. +0 −128 src/cells/memory.js
  56. +419 −0 src/cells/memory.mjs
  57. +0 −86 src/cells/mux.js
  58. +191 −0 src/cells/mux.mjs
  59. +0 −85 src/cells/subcircuit.js
  60. +149 −0 src/cells/subcircuit.mjs
  61. +357 −0 src/circuit.mjs
  62. +135 −0 src/elkjs.mjs
  63. +6 −0 src/engines.mjs
  64. +58 −0 src/engines/base.mjs
  65. +56 −0 src/engines/browsersynch.mjs
  66. +203 −0 src/engines/synch.mjs
  67. +487 −0 src/engines/worker-worker.mjs
  68. +296 −0 src/engines/worker.mjs
  69. +0 −98 src/help.js
  70. +70 −0 src/help.mjs
  71. +0 −268 src/index.js
  72. +249 −0 src/index.mjs
  73. +158 −0 src/iopanel.mjs
  74. +306 −0 src/monitor.mjs
  75. +96 −403 src/style.css
  76. +0 −150,540 src/test/sextium.json
  77. +0 −15 src/test/template.html
  78. +62 −0 src/tools.mjs
  79. +466 −0 src/transform.mjs
  80. +785 −0 tests/index.test.mjs
  81. +21 −31 webpack.config.js
13 changes: 13 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"env": {
"test": {
"presets": [
["@babel/preset-env",
{
"modules": "commonjs",
"exclude": ["babel-plugin-transform-exponentiation-operator"]
}]
]
}
}
}
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: tilk
67 changes: 67 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ master ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
schedule:
- cron: '38 3 * * 6'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
29 changes: 29 additions & 0 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Node.js CI

on: [push, pull_request]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm run build --if-present
- run: npm test
env:
CI: true
- name: Upload artifact
uses: actions/upload-artifact@v1.0.0
with:
name: webpack
path: dist
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/dist
/node_modules
/lib
*.swp
3 changes: 0 additions & 3 deletions .travis.yml

This file was deleted.

68 changes: 68 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Changelog
All notable changes to this project will be documented in this file.

## [0.13.0] -- 2023-03-2023

### Added
- Circuit zooming buttons

### Fixed
- Fixed undefined reference in memory

## [0.12.1] -- 2022-03-17

### Fixed
- The cells, tools, engines and transforms namespaces are now exported for non-browser environments.

## [0.12.0] -- 2022-02-22

### Fixed
- Fix the lifetime of the event listeners for the sub-windows (Contributor: Yichao Yu)
- Fix binary mux transform for Yosys 0.12 and later
- Elkjs layout change marked as batch (Contributor: Yichao Yu)
- Save IO port orders for subcircuits (Contributor: Yichao Yu)

## [0.11.0] -- 2022-02-03

### 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)
- The interface now works better with touch devices. (Contributor: Yichao Yu)

### Fixed
- The `*Const` family of arithmetic operations is now correctly JSON serialized, and they are better tested. (Contributor: Yichao Yu)
- Parameter changes (e.g. clock speed) are now propagated to the worker thread in the WebWorker engine.

## [0.10.0] -- 2021-10-06

### Added
- The `Dff` block can now have built-in synchronous reset.
- The `Dff` block can now have `set` and `clr` inputs for setting/resetting individual bits.
- The `Memory` block can now have an initialization value, synchronous and asynchronous reset for synchronous read ports.
- The `Memory` block can now have port transparency behavior different for each write port.

### Changed
- The `Memory` block has working bit enables for write ports.
- The `Memory` block can now have single bit write enables.

## [0.9.0] -- 2021-08-17

### Added
- A new simulation engine, using Web Workers, has been added. It is more responsible and can be much faster than the original one (25x measured improvement).

### Changed
- Architecture was changed to enable simulation engines running concurrently with the UI.
- Webpack updated to version 5.

## [0.8.0] -- 2021-07-21

### Added
- Circuit graph transformations, which make common circuits generated by Yosys more readable.
- MuxSparse, a new multiplexer cell for situations when only a few of possible options is defined.
- ElkJS layout engine, which is (in contrast to Dagre) aware of ports.

### Changed
- Gates can now have more than two inputs.

151 changes: 141 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,53 @@
[![Build Status](https://travis-ci.org/tilk/digitaljs.svg?branch=master)](https://travis-ci.org/tilk/digitaljs)
![][digitaljs-logo]

# DigitalJS

This project is a digital circuit simulator implemented in Javascript.
It is designed to simulate circuits synthesized by hardware design tools
like [Yosys](http://www.clifford.at/yosys/), and it has a companion project
like [Yosys](https://yosyshq.net/yosys/) (Github repo [here](https://github.com/YosysHQ/yosys/)), and it has a companion project
[yosys2digitaljs](https://github.com/tilk/yosys2digitaljs), which converts
Yosys output files to DigitalJS. It is also intended to be a teaching tool,
therefore readability and ease of inspection is one of top concerns for
the project.

You can [try it out online](https://digitaljs.tilk.eu/). The web app is
[a separate Github project](https://github.com/tilk/digitaljs_online/).

# Usage

You can use DigitalJS in your project by installing it from NPM:

```bash
npm install digitaljs
```

Or you can use the [Webpack bundle](https://tilk.github.io/digitaljs/main.js) directly.

To simulate a circuit represented using the JSON input format (described later)
and display it on a `div` named `#paper`, you need to run the following
JS code ([see running example](https://tilk.github.io/digitaljs/test/fulladder.html)):

```javascript
// create the simulation object
const circuit = new digitaljs.Circuit(input_goes_here);
// display on #paper
const paper = circuit.displayOn($('#paper'));
// activate real-time simulation
circuit.start();
```

# Input format

Circuits are represented using JSON. The top-level object has three keys, `devices`,
`connectors` and `subcircuits`. Under `devices` is a list of all devices forming
the circuit, represented as an object, where keys are (unique and internal) device
names. Each device has a number of properties, which are represented by an object.
A mandatory property is `celltype`, which specifies the type of the device. Example
A mandatory property is `type`, which specifies the type of the device. Example
device:

```javascript
"dev1": {
"celltype": "$and",
"type": "And",
"label": "AND1"
}
```
@@ -46,21 +73,125 @@ an input port, and the bitwidth of both ports must be equal. Example connection:

Under `subcircuits` is a list of subcircuit definitions, represented as an object,
where keys are unique subcircuit names. A subcircuit name can be used as
a device `celltype`; this instantiates the subcircuit. A subcircuit definition
a `celltype` for a device of type `Subcircuit`; this instantiates the subcircuit.
A subcircuit definition
follows the representation of whole circuits, with the exception that subcircuits
cannot (currently) define their own subcircuits. A subcircuit can include
`$input` and `$output` devices, these are mapped to ports on a subcircuit
`Input` and `Output` devices, these are mapped to ports on a subcircuit
instance.

## Device types

* Unary gates: `Not`, `Repeater`
* Attributes: `bits` (natural number)
* Inputs: `in` (`bits`-bit)
* Outputs: `out` (`bits`-bit)
* N-ary gates: `And`, `Nand`, `Or`, `Nor`, `Xor`, `Xnor`
* Attributes: `bits` (natural number), `inputs` (natural number, default 2)
* Inputs: `in1`, `in2` ... `inN` (`bits`-bit, `N` = `inputs`)
* Outputs: `out` (`bits`-bit)
* Reducing gates: `AndReduce`, `NandReduce`, `OrReduce`, `NorReduce`, `XorReduce`, `XnorReduce`
* Attributes: `bits` (natural number)
* Inputs: `in` (`bits`-bit)
* Outputs: `out` (1-bit)
* Bit shifts: `ShiftLeft`, `ShiftRight`
* Attributes: `bits.in1`, `bits.in2` and `bits.out` (natural number), `signed.in1`, `signed.in2`, `signed.out` and `fillx` (boolean)
* Inputs: `in1` (`bits.in1`-bit), `in2` (`bits.in2`-bit)
* Outputs: `out` (`bits.out`-bit)
* Comparisons: `Eq`, `Ne`, `Lt`, `Le`, `Gt`, `Ge`
* Attributes: `bits.in1` and `bits.in2` (natural number), `signed.in1` and `signed.in2` (boolean)
* Inputs: `in1` (`bits.in1`-bit), `in2` (`bits.in2`-bit)
* Outputs: `out` (1-bit)
* Number constant: `Constant`
* Attributes: `constant` (binary string)
* Outputs: `out` (`constant.length`-bit)
* Unary arithmetic: `Negation`, `UnaryPlus`
* Attributes: `bits.in` and `bits.out` (natural number), `signed` (boolean)
* Inputs: `in` (`bits.in`-bit)
* Outputs: `out` (`bits.out`-bit)
* Binary arithmetic: `Addition`, `Subtraction`, `Multiplication`, `Division`, `Modulo`, `Power`
* Attributes: `bits.in1`, `bits.in2` and `bits.out` (natural number), `signed.in1` and `signed.in2` (boolean)
* Inputs: `in1` (`bits.in1`-bit), `in2` (`bits.in2`-bit)
* Outputs: `out` (`bits.out`-bit)
* Multiplexer: `Mux`
* Attributes: `bits.in`, `bits.sel` (natural number)
* Inputs: `in0` ... `inN` (`bits.in`-bit, `N` = 2**`bits.sel`-1), `sel` (`bits.sel`-bit)
* Outputs: `out` (`bits.in`-bit)
* One-hot multiplexer: `Mux1Hot`
* Attributes: `bits.in`, `bits.sel` (natural number)
* Inputs: `in0` ... `inN` (`bits.in`-bit, `N` = `bits.sel`), `sel` (`bits.sel`-bit)
* Outputs: `out` (`bits.in`-bit)
* Sparse multiplexer: `MuxSparse`
* Attributes: `bits.in`, `bits.sel` (natural number), `inputs` (list of natural numbers), `default_input` (optional boolean)
* Inputs: `in0` ... `inN` (`bits.in`-bit, `N` = `inputs.length`, +1 if `default_input` is true)
* Outputs: `out` (`bits.in`-bit)
* D flip-flop: `Dff`
* Attributes: `bits` (natural number), `polarity.clock`, `polarity.arst`, `polarity.srst`, `polarity.aload`, `polarity.set`, `polarity.clr`, `polarity.enable`, `enable_srst` (optional booleans), `initial` (optional binary string), `arst_value`, `srst_value` (optional binary string), `no_data` (optional boolean)
* Inputs: `in` (`bits`-bit), `clk` (1-bit, if `polarity.clock` is present), `arst` (1-bit, if `polarity.arst` is present), `srst` (1-bit, if `polarity.srst` is present), `en` (1-bit, if `polarity.enable` is present), `set` (1-bit, if `polarity.set` is present), `clr` (1-bit, if `polarity.clr` is present), `ain` (`bits`-bit, if `polarity.aload` is present), `aload` (1-bit, if `polarity.aload` is present)
* Outputs: `out` (`bits`-bit)
* Memory: `Memory`
* Attributes: `bits`, `abits`, `words`, `offset` (natural number), `rdports` (array of read port descriptors), `wrports` (array of write port descriptors), `memdata` (memory contents description)
* Read port descriptor attributes: `enable_polarity`, `clock_polarity`, `arst_polarity`, `srst_polarity` (optional booleans), `init_value`, `arst_value`, `srst_value` (optional binary strings), `transparent`, `collision` (optional booleans or arrays of booleans)
* Write port descriptor attributes: `enable_polarity`, `clock_polarity`, `no_bit_enable` (optional booleans)
* Inputs (per read port): `rdKaddr` (`abits`-bit), `rdKen` (1-bit, if `enable_polarity` is present), `rdKclk` (1-bit, if `clock_polarity` is present), `rdKarst` (1-bit, if `arst_polarity` is present), `rdKsrst` (1-bit, if `srst_polarity` is present)
* Outputs (per read port): `rdKdata` (`bits`-bit)
* Inputs (per write port): `wrKaddr` (`abits`-bit), `wrKdata` (`bits`-bit), `wrKen` (1-bit (when `no_bit_enable` is true) or `bits`-bit (otherwise), if `enable_polarity` is present), `wrKclk` (1-bit, if `clock_polarity` is present)
* Clock source: `Clock`
* Outputs: `out` (1-bit)
* Button input: `Button`
* Outputs: `out` (1-bit)
* Lamp output: `Lamp`
* Inputs: `in` (1-bit)
* Number input: `NumEntry`
* Attributes: `bits` (natural number), `numbase` (string)
* Outputs: `out` (`bits`-bit)
* Number output: `NumDisplay`
* Attributes: `bits` (natural number), `numbase` (string)
* Inputs: `in` (`bits`-bit)
* Subcircuit input: `Input`
* Attributes: `bits` (natural number)
* Outputs: `out` (`bits`-bit)
* Subcircuit output: `Output`
* Attributes: `bits` (natural number)
* Inputs: `in` (`bits`-bit)
* 7 segment display output: `Display7`
* Inputs: `bits` (8-bit only - most significant bit controls decimal point LED)
* Bus grouping: `BusGroup`
* Attributes: `groups` (array of natural numbers)
* Inputs: `in0` (`groups[0]`-bit) ... `inN` (`groups[N]`-bit)
* Outputs: `out` (sum-of-`groups`-bit)
* Bus ungrouping: `BusUngroup`
* Attributes: `groups` (array of natural numbers)
* Inputs: `in` (sum-of-`groups`-bit)
* Outputs: `out0` (`groups[0]`-bit) ... `outN` (`groups[N]`-bit)
* Bus slicing: `BusSlice`
* Attributes: `slice.first`, `slice.count`, `slice.total` (natural number)
* Inputs: `in` (`slice.total`-bit)
* Outputs: `out` (`slice.count`-bit)
* Zero- and sign-extension: `ZeroExtend`, `SignExtend`
* Attributes: `extend.input`, `extend.output` (natural number)
* Inputs: `in` (`extend.input`-bit)
* Outputs: `out` (`extend.output`-bit)
* Finite state machines: `FSM`
* Attributes: `bits.in`, `bits.out`, `states`, `init_state`, `current_state` (natural number), `trans_table` (array of transition descriptors)
* Transition descriptor attributes: `ctrl_in`, `ctrl_out` (binary strings), `state_in`, `state_out` (natural numbers)
* Inputs: `clk` (1-bit), `arst` (1-bit), `in` (`bits.in`-bit)
* Outputs: `out` (`bits.out`-bit)

# TODO

Some ideas for further developing the simulator.

* Display/editor for RAM/ROM contents.
* Simulation time control: changing the tick time, pausing the simulation.
* Displaying waveforms for selected wires.
* Use JointJS elementTools for configuring/removing gates.
* RAM/ROM import/export for Verilog format and Intel HEX.
* Framebuffer element with character/bitmap display.
* More editing capability: adding and removing blocks, modifying some of blocks' properties.
* Undo-redo capability.
* Saving and loading circuits, including layout and state.
* Generic handling of negation for unary/binary gates (negation on inputs/outputs) for better clarity.
* Better algorithm for graph layout.
* SVG export.
* Verilog export.
* Smartphone and tablet compatible UI.

[digitaljs-logo]: docs/resources/digitaljs_textpath_right.svg

15 changes: 15 additions & 0 deletions babel.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"presets": [
[
"@babel/preset-env",
{
"targets": {
"node": true
},
"modules": "cjs",
"exclude": ["babel-plugin-transform-exponentiation-operator"]
}
]
],
"plugins": ["babel-plugin-add-import-extension", "babel-plugin-transform-import-meta"]
}
Loading