Git Product home page Git Product logo

logic2's Introduction

Logic Simulator 2

A work-in-progress/experimental IDE for experimentation with Francis Stokes (Low Level Javascript) Digital Circuit Simulator

Live Web Version

Screenshot

Installation

npm install
npm run serve

Features

  1. Micro-subset verilog-like DSL for coding the array of logic gates (parsed using Antlr)
  2. Monaco-based code editor with automatic linting/error reporting, smart indentation, code folding, hints
  3. IDE docking ui courtesy of JupyterLab's Lumino widgets
  4. Schematic visualisation courtesy of d3-hwschematic
  5. Testbench simulation with graphical trace output and schematic animation
  6. Circuit description as gates, boolean logic or verilog behavioural model
  7. Generate arbitrary outputs from truth table and Sum of Products or Karnaugh Map

DSL

  1. Modules define a group of gates (eg a logic chip) and the inputs and outputs (eg the pins) between modules

      module MyModule(input A,
                      input B,
                      output Q)
        // gate, wire and instance statements here
      endmodule
  2. Gates define a basic logic function, a unique identifier for this gate, and the inputs to the gate

      wire myAndGate;
      and(myAndGate, A, B); // equivalent to myAndGate = A & B
  3. Instances of gates define a namespaced copy of a module and the connections between the parent module and the instance module

      MyModule m1(.A(parentVar1), .B(parentVar2), .Q(parentVar3))
  4. All programs must have a "main" module which is automatically instanced and serves as the entry point.

    a) The main module automatically includes a "clock" input. b) The inputs to the main module will be external "control" gates eg buttons/sensors

  5. The main module should include a testbench section to define the value of the control gates at different time points

     test begin
         #00 {a=0, b=0};
         #05 {a=0, b=1};
         #10 {a=1, b=0};
         #15 {a=1, b=1};
     end
  6. Limited support for verilog behavioural modelling - initial and always blocks, if/case statements

TODO

  1. Ben Eater 8 bit CPU simulation - done
    1. Add $compile to generate Ben Eater machine code
    2. Convert bus to module with custom $display port positions
    3. Move tristate buffer into individual registers
  2. Speed up simulation and compilation
    1. Gates should be lookup, not array.find/filter
    2. WebWorker? - failed - can't pass class objects
    3. Simulation progress monitor
  3. More advanced CPU designs - currently simulation too slow, makes this infeasible

Acknowledgements

  1. LowLevelJavascript Digital Circuit Simulator
  2. Antlr
  3. Monaco Editor
  4. d3-hwschematic
  5. Lumino Widgets
  6. Vue
  7. Buefy

logic2's People

Contributors

dkilfoyle avatar

Stargazers

 avatar  avatar Ishan Khatri avatar Ibrahim Hazmi avatar  avatar Ricky Chon avatar Helple avatar  avatar Job Tijhuis avatar kongwenyan avatar  avatar Ali Osman Aksu avatar  avatar  avatar Nikhil Tomar avatar Karan Naik avatar  avatar Feng Shi avatar  avatar Sajad avatar Chase Ruskin avatar 夜云 avatar Photon avatar Margret Riegert avatar Carlos Alberto Ruiz Naranjo avatar Miao Yuyang avatar Miao Yuchi avatar Satya Mishra avatar Steve Hagins avatar  avatar Tanner Kern avatar

Watchers

James Cloos avatar  avatar

logic2's Issues

Support setting specific bits of multi-bit components

Currently the only way to set a specific bit for a multi-bit component such as a register is to rewrite the entire value

myRegister = 3; // will set my register to 0b11

Need to implement ability to set specific bits such as

myRegister[1] = 1;

This should only be allowed for components where setting a specific bit makes sense = registers, multibit buffers/wires.

This will be best accomplished by refactoring "gates" into component class hierarchy:

  1. Component {state:Numeric, inputs:[], update(), setValue(), getValue()}
    1. Gate extends Component {logicFn: and, or etc, function in update}
    2. SevenSeg
    3. Number
    4. MaskableComponent { inputMasks: [] = which bits the input contributes to, setValue(x, mask), update calls setValue for each input }
      1. Register
      2. Wire

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.