""" Author: Bart Meyers Date: October 2012 Modification to 16bit/16bit datapath: September 2013 Modification to 16bit/12bit datapath: October 2014 Modification to 13bit/8bit datapath: August 2015 usage: python Test.py option options: -a : test alu -s : test simple datapath (only r-type and sw/lw) -f : test full datapath (all instructions) Needs to be in the same folder as logisim-generic-2.7.1.jar This program will convert test cases (currently only ALU tests) to logisim dat files, which can be loaded into your logisim project. If this project includes the main circuit of ALU_GroupXX.circ, running this program with the project as last argument will behave as a test run: logisim will read in a test and oracle, and produce outputs for each test. Then, this program will parse this output and verify whether the test result is the same as the oracle. To support different datapaths, make changes starting from "Variability" label until "End Variability" label (end of file). """ import sys, re, os from pprint import pprint def pattern(patterns, can_have_label=False): fullpattern = r'^\s*' # pattern must start in the beginning of a line if can_have_label: fullpattern += "(?P