Home

Simulators

Download: csci201-simulators-v2.7.zip

This package consists of three graphical simulators:

Installation

No “installation” is required. Just unzip the package.

Hardware simulator

Run the hardware simulator with this command (Windows):

HardwareSimulator.bat

Or this command (Mac, Linux):

./HardwareSimulator.sh

Example 1: Debug an HDL file

Suppose you were tasked with writing an HDL file that implements the OR gate in terms of AND and NOT. Here is the correct HDL file:

/**
 * Or gate:
 * out = 1 if (a == 1 or b == 1)
 *       0 otherwise
 */

/* This version uses only AND and NOT gates. */

CHIP Or {
    IN a, b;
    OUT out;

    PARTS:
    Not(in=a, out=nota);
    Not(in=b, out=notb);
    And(a=nota, b=notb, out=and);
    Not(in=and, out=out);
}

Load this HDL file with the “chip” icon:

HW Sim

Then play around with different input values and hit the “>” icon to evaluate your chip:

HW Sim

Example 2: Test an HDL file

You’ll want to test your chip with the .tst scripts I provide. You should have your HDL file and my .cmp file in the same folder as the .tst script.

Load the test script with the “scroll” icon:

HW Sim

Then run all test cases with the “>>” icon. If a test fails, the status bar (at the bottom) will tell you which test failed.

HW Sim

You can also view the desired output by selecting “Compare” from the “View” menu (shown below). Use the same drop-down menu to view your chip’s output by selecting “Output” from the menu.

HW Sim

CSCI 201 material by Joshua Eckroth is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License. Source code for this website available at GitHub.