Skip to content
This repository has been archived by the owner on Jul 8, 2022. It is now read-only.

gjp/s9-e3

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Academic Exercise: Digital Logic Simulator

written by Gregory Parkhurst for Mendicant University core skills session #9

What does this thing do?

circuitsim reads a set of digital logic definition files in JSON format and computes either the output for a given input or a truth table.

How do I run it?

Example run commands and output:

> ruby bin/circuitsim.rb --circuit TwoBitAdder --input "Cin:0 A1:1 A2:0 B1:1 B2:0" data/circuits/*.json
Loaded circuit FullAdder
Loaded circuit MUX21
Loaded circuit TwoBitAdder

output: ["S1: false", "S2: true", "Cout: false"]

> ruby bin/circuitsim.rb --truth --circuit FullAdder data/circuits/*.json
Loaded circuit FullAdder
Loaded circuit MUX21
Loaded circuit TwoBitAdder

output: ["S: false", "Cout: false"]

 A  B  Cin  S  Cout
[0, 0, 0, 0, 0]
[0, 0, 1, 1, 0]
[0, 1, 0, 1, 0]
[0, 1, 1, 0, 1]
[1, 0, 0, 1, 0]
[1, 0, 1, 0, 1]
[1, 1, 0, 0, 1]
[1, 1, 1, 1, 1]

Issues

  • Input format should be documented
  • The circuit graph uses separate but similar data structures. These should be merged into a single structure with a new class as nodes

Future Expansion

  • A front-end for building the logic definition files
  • A back-end for displaying a completed circuit and the state of each trace

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 100.0%