Skip to content

Open-source Logisim circuit black-box testing platform for Logic Design homeworks.

License

Notifications You must be signed in to change notification settings

ozansz/logisim-testbench

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CENG232 Logisim TestBench

This project aims for creating an open-source Logisim circuit black-box testing platform for CENG232 Logic Design homeworks.

Technology stack: I used Python3 and Bash for scripts. Also JSON file type is used for circuit functionality definitions.

Contributors

İlker Koşaroğlu @ilkerkosaroglu

Yiğitcan Uçan @ucanyiit

Dependencies

There is no need to install any software to use this tool if you are working in a Linux-based platform. The Logisim Evolution version is already included in the project root.

The only dependencies are:

  • Python3
  • PyQt5
  • Bash

An example GUI output for a successfull testing is as below,

Installation

The project requires only PyQt5 to be installed. To install it, just run the command below,

pip3 install -r requirements.txt

This will install all of the requirements to your local workspace.

GUI

The last version of TestBench comes with a sweet UI. To use the testbench with graphical interface, just run the command below,

python3 tester.py

Usage

Test Configuration

To use the TestBench, you need to configure the circuit functionality. This is made using JSON file type.

The configuration file consists of three parst. Input, output and variables. Inputs are bound to variables, then variables are used to configure outputs.

Input pins => Variables => Output pins

Inputs

The inputs part is an array of strings. The elements must be of the labels of inputs pins in the .circ file.

Example,

"inputs": [
    "A",
    "B"
]

Variables

The variables are Pythonic structures that holds the value of one or more pins. These variables are used to define the functionality of output pins.

  • Only input pins can be used in variable definition.
  • Variables can hold value of one or more pins.
  • Definitions are Python expressions.
  • Pins are expressed using a dollar-sign in definitions, such as Bash scrips.
  • One-pin value variable is defined as int($PIN) for a pin named 'PIN'
  • Two-pin value variable is defined using pipe operator (|) such as $P1 | $P0 for pins named 'P1' and 'P0'.
  • Many-pin value variable is defined as $PA | $PB | $PC | ..., using the pipe operator more than once.

Example,

"variables": {
    "a": "int($A)",
    "b": "int($B)",
    "c": "$C | $D"
}

Outputs

The outputs are also Pythonic structures that holds the value of output pins. The output pins are defined using only variables.

  • Only variables can be used in output pin definition.
  • Definitions are Python expressions.
  • Variables are expressed using a dollar-sign in definitions, such as Bash scrips.

Example,

"outputs": {
    "AND": "$a * $b",
    "OR": "$a + $b",
    "NOR": "($a + $b) != 0"
}

There is a well done example configuration below,

{
    "inputs": [
        "A",
        "B"
    ],
    "variables": {
        "a": "int($A)",
        "b": "int($B)"
    },
    "outputs": {
        "AND": "$a * $b",
        "OR": "$a + $b",
        "NOR": "($a + $b) != 0",
        "XOR": "($a + $b) % 2",
        "XNOR": "($a + $b) % 2 == 0"
    }
}

The equivalent functions for the configuration above is,

AND = A && B;
OR = A || B;
NOR = !(A || B);
XOR = A ^ B;
XNOR = !(A ^ B);

The Test Runner

When the configuration file is ready, the only thing to be done to test your circuit is to use the runtest.sh script. It will automatically generate truth tables and test your circuit through the test cases.

The test runner script is deprecated. Please use the gui (tester.py) instead.

Known issues

You cannot construct complex circuit definitions with the current parsing technique. Honestly, I could have designed a description language and its parser, compiler etc. for this project, but I have many projects to contribute :)

Getting help

You can get in contact with me using my e-mail addresses,

Getting involved

If you want to contribute to my project, there are a few features I would appreciate if someone else helps me to implement,

  • Custom description language and parser
  • Graphical interface for the whole tool
  • Better code documentation

Open source licensing info

  1. LICENSE
  2. CFPB Source Code Policy