ECE 250 CS 250 CPU Logisim Test Guide

1. Booting Computer
To begin testing the functionality of your CPU, follow these steps:
2. Settheclocktoitsinitiallowstatebypokingit.
3. Triggertheresetinputonandoff.
4. Ifyouneedtoprovideinputtothekeyboard,dosoatthispoint.
1. Loadtheprogram’sinstructionanddatamemoryintotheROMand
RAM blocks, respectively.
5. Useeitherthemanual”TickOnce”function(Ctrl+T)ortheautomatic
“Ticks Enabled” function (Ctrl+K) to start the program execution.
2. AutomatedTesting
For the self-test tool to work, your circuit must meet the following requirements:
1. Name your circuit file “cpu.circ” and store it in the same directory as the tool and data.
2. Use a component called “RegisterFile” (capitalization matters) as your register file.
3. Use an input named “reset” (capitalization matters) as your reset signal.
4. Place a Probe on each register in your register file and name them “r0”, “r1”, “r2”, etc.
5. Set the default state of all D flip-flops to 0 to avoid issues with tests that toggle the
reset signal.
6. You can use Probes for your own purposes, but leave their label blank. The tester
ignores unlabeled probes, but labeled probes other than “r0”, “r1”, etc. will affect the
7. Configure the TTY with 13 rows, 80 columns, and rising edge.
8. Use a ROM component only for instruction memory, as the tool will overwrite every
ROM component in your circuit with instruction data.
9. Make sure you have Python and Java 1.6/1.7/1.8 installed to run the tester. The tool
has been tested on Course Linux, but it should work on other environments as long as
the required Java Runtime Environment is available.
10. Do not use the “Project | Add Library” feature, as it will break your submission online¡£
Instead, use the “File | Merge” feature to bring in circuits from other files. You may need
to rename circuits to avoid conflicts.
To view a usage message, run the command ” ./hwtest.py”. The command will generate files named
“actual.txt” and “diff.txt” to show your output and the differences between your output and the expected
output. The assembly language source code for the CPU 250/16 tests is located in the “programs/”
directory. Refer to the assembler and simulator section in this document for more information.
If you want to manually run a specific command line test, you can use the Logisim command-line version
directly. Check the “settings.json” file for the test configuration, especially the arguments. For example, the
“simple” test has the following arguments:
Github
“-c”, “10”,
“-ic”, “0,reset=1:1,reset=0”,
“-lo”, “tests/simple.imem.lgsim”,
one command):
“-la”, “tests/simple.dmem.lgsim”
To execute this test manually, apply the arguments on the command line as follows (note that this is all
java -jar logisim_ev_cli.jar -f cpu.circ -c 10 -ic 1,reset=1:2,reset=0 -lo tests/simple.imem.lgsim -la
tests/simple.dmem.lgsim
3. Assembler & Simulator
We are providing an assembler and a simulator for you to generate test programs and to
verify your program¡¯s behavior. The assembler and simulator are included in the folder

Computer Science Tutoring
4. Final Tests
After passing all the tests, you can run the demo programs that come included:
¡ñ demo-fib-print.s: This program uses an iterative approach instead of recursive
and prints the resulting numbers to the TTY. The recurse.s test performed by the
tester only returns fib(4) into a register.
¡ñ demo-prime-print.s: This program computes prime numbers, which is a
challenging task for a CPU without a divide instruction!
To run these programs, you need to use the included assembler tool to produce imem
and dmem files as they do not come pre-assembled. Running these programs at a high clock speed will cause your CPU to pulse and generate numbers after numbers to the console.
Code Help, Add WeChat: cstutorcs