354 lines
4.0 KiB
Scilab
354 lines
4.0 KiB
Scilab
|
// This file is part of the materials accompanying the book
|
||
|
// "The Elements of Computing Systems" by Nisan and Schocken,
|
||
|
// MIT Press. Book site: www.idc.ac.il/tecs
|
||
|
// File name: projects/02/ALU-nostat.tst
|
||
|
|
||
|
// ALU-nostat.tst provides a partial test of the ALU chip.
|
||
|
// It IS NOT a replacement for ALU.tst.
|
||
|
|
||
|
// ALU-nostat.tst tests only the computation part of the ALU.
|
||
|
// The 'zr' and 'ng' status outputs are ignored.
|
||
|
|
||
|
// This test lets you concentrate on getting the ALU computation right without the
|
||
|
// additional task of handling the status outputs.
|
||
|
|
||
|
// Once your ALU passes ALU-nostat.tst you need to test it with ALU.tst.
|
||
|
// This way, any comparison failures during ALU.tst will be caused by errors in
|
||
|
// the handling of the 'zr' and 'ng' status outputs.
|
||
|
|
||
|
load ALU.hdl,
|
||
|
output-file ALU-nostat.out,
|
||
|
compare-to ALU-nostat.cmp,
|
||
|
output-list x%B1.16.1 y%B1.16.1 zx%B1.1.1 nx%B1.1.1 zy%B1.1.1
|
||
|
ny%B1.1.1 f%B1.1.1 no%B1.1.1 out%B1.16.1;
|
||
|
|
||
|
set x %B0000000000000000,
|
||
|
set y %B1111111111111111,
|
||
|
|
||
|
set zx 1,
|
||
|
set nx 0,
|
||
|
set zy 1,
|
||
|
set ny 0,
|
||
|
set f 1,
|
||
|
set no 0,
|
||
|
eval,
|
||
|
output;
|
||
|
|
||
|
set zx 1,
|
||
|
set nx 1,
|
||
|
set zy 1,
|
||
|
set ny 1,
|
||
|
set f 1,
|
||
|
set no 1,
|
||
|
eval,
|
||
|
output;
|
||
|
|
||
|
set zx 1,
|
||
|
set nx 1,
|
||
|
set zy 1,
|
||
|
set ny 0,
|
||
|
set f 1,
|
||
|
set no 0,
|
||
|
eval,
|
||
|
output;
|
||
|
|
||
|
set zx 0,
|
||
|
set nx 0,
|
||
|
set zy 1,
|
||
|
set ny 1,
|
||
|
set f 0,
|
||
|
set no 0,
|
||
|
eval,
|
||
|
output;
|
||
|
|
||
|
set zx 1,
|
||
|
set nx 1,
|
||
|
set zy 0,
|
||
|
set ny 0,
|
||
|
set f 0,
|
||
|
set no 0,
|
||
|
eval,
|
||
|
output;
|
||
|
|
||
|
set zx 0,
|
||
|
set nx 0,
|
||
|
set zy 1,
|
||
|
set ny 1,
|
||
|
set f 0,
|
||
|
set no 1,
|
||
|
eval,
|
||
|
output;
|
||
|
|
||
|
set zx 1,
|
||
|
set nx 1,
|
||
|
set zy 0,
|
||
|
set ny 0,
|
||
|
set f 0,
|
||
|
set no 1,
|
||
|
eval,
|
||
|
output;
|
||
|
|
||
|
set zx 0,
|
||
|
set nx 0,
|
||
|
set zy 1,
|
||
|
set ny 1,
|
||
|
set f 1,
|
||
|
set no 1,
|
||
|
eval,
|
||
|
output;
|
||
|
|
||
|
set zx 1,
|
||
|
set nx 1,
|
||
|
set zy 0,
|
||
|
set ny 0,
|
||
|
set f 1,
|
||
|
set no 1,
|
||
|
eval,
|
||
|
output;
|
||
|
|
||
|
set zx 0,
|
||
|
set nx 1,
|
||
|
set zy 1,
|
||
|
set ny 1,
|
||
|
set f 1,
|
||
|
set no 1,
|
||
|
eval,
|
||
|
output;
|
||
|
|
||
|
set zx 1,
|
||
|
set nx 1,
|
||
|
set zy 0,
|
||
|
set ny 1,
|
||
|
set f 1,
|
||
|
set no 1,
|
||
|
eval,
|
||
|
output;
|
||
|
|
||
|
set zx 0,
|
||
|
set nx 0,
|
||
|
set zy 1,
|
||
|
set ny 1,
|
||
|
set f 1,
|
||
|
set no 0,
|
||
|
eval,
|
||
|
output;
|
||
|
|
||
|
set zx 1,
|
||
|
set nx 1,
|
||
|
set zy 0,
|
||
|
set ny 0,
|
||
|
set f 1,
|
||
|
set no 0,
|
||
|
eval,
|
||
|
output;
|
||
|
|
||
|
set zx 0,
|
||
|
set nx 0,
|
||
|
set zy 0,
|
||
|
set ny 0,
|
||
|
set f 1,
|
||
|
set no 0,
|
||
|
eval,
|
||
|
output;
|
||
|
|
||
|
set zx 0,
|
||
|
set nx 1,
|
||
|
set zy 0,
|
||
|
set ny 0,
|
||
|
set f 1,
|
||
|
set no 1,
|
||
|
eval,
|
||
|
output;
|
||
|
|
||
|
set zx 0,
|
||
|
set nx 0,
|
||
|
set zy 0,
|
||
|
set ny 1,
|
||
|
set f 1,
|
||
|
set no 1,
|
||
|
eval,
|
||
|
output;
|
||
|
|
||
|
set zx 0,
|
||
|
set nx 0,
|
||
|
set zy 0,
|
||
|
set ny 0,
|
||
|
set f 0,
|
||
|
set no 0,
|
||
|
eval,
|
||
|
output;
|
||
|
|
||
|
set zx 0,
|
||
|
set nx 1,
|
||
|
set zy 0,
|
||
|
set ny 1,
|
||
|
set f 0,
|
||
|
set no 1,
|
||
|
eval,
|
||
|
output;
|
||
|
|
||
|
set x %B101101110100000,
|
||
|
set y %B001111011010010,
|
||
|
|
||
|
set zx 1,
|
||
|
set nx 0,
|
||
|
set zy 1,
|
||
|
set ny 0,
|
||
|
set f 1,
|
||
|
set no 0,
|
||
|
eval,
|
||
|
output;
|
||
|
|
||
|
set zx 1,
|
||
|
set nx 1,
|
||
|
set zy 1,
|
||
|
set ny 1,
|
||
|
set f 1,
|
||
|
set no 1,
|
||
|
eval,
|
||
|
output;
|
||
|
|
||
|
set zx 1,
|
||
|
set nx 1,
|
||
|
set zy 1,
|
||
|
set ny 0,
|
||
|
set f 1,
|
||
|
set no 0,
|
||
|
eval,
|
||
|
output;
|
||
|
|
||
|
set zx 0,
|
||
|
set nx 0,
|
||
|
set zy 1,
|
||
|
set ny 1,
|
||
|
set f 0,
|
||
|
set no 0,
|
||
|
eval,
|
||
|
output;
|
||
|
|
||
|
set zx 1,
|
||
|
set nx 1,
|
||
|
set zy 0,
|
||
|
set ny 0,
|
||
|
set f 0,
|
||
|
set no 0,
|
||
|
eval,
|
||
|
output;
|
||
|
|
||
|
set zx 0,
|
||
|
set nx 0,
|
||
|
set zy 1,
|
||
|
set ny 1,
|
||
|
set f 0,
|
||
|
set no 1,
|
||
|
eval,
|
||
|
output;
|
||
|
|
||
|
set zx 1,
|
||
|
set nx 1,
|
||
|
set zy 0,
|
||
|
set ny 0,
|
||
|
set f 0,
|
||
|
set no 1,
|
||
|
eval,
|
||
|
output;
|
||
|
|
||
|
set zx 0,
|
||
|
set nx 0,
|
||
|
set zy 1,
|
||
|
set ny 1,
|
||
|
set f 1,
|
||
|
set no 1,
|
||
|
eval,
|
||
|
output;
|
||
|
|
||
|
set zx 1,
|
||
|
set nx 1,
|
||
|
set zy 0,
|
||
|
set ny 0,
|
||
|
set f 1,
|
||
|
set no 1,
|
||
|
eval,
|
||
|
output;
|
||
|
|
||
|
set zx 0,
|
||
|
set nx 1,
|
||
|
set zy 1,
|
||
|
set ny 1,
|
||
|
set f 1,
|
||
|
set no 1,
|
||
|
eval,
|
||
|
output;
|
||
|
|
||
|
set zx 1,
|
||
|
set nx 1,
|
||
|
set zy 0,
|
||
|
set ny 1,
|
||
|
set f 1,
|
||
|
set no 1,
|
||
|
eval,
|
||
|
output;
|
||
|
|
||
|
set zx 0,
|
||
|
set nx 0,
|
||
|
set zy 1,
|
||
|
set ny 1,
|
||
|
set f 1,
|
||
|
set no 0,
|
||
|
eval,
|
||
|
output;
|
||
|
|
||
|
set zx 1,
|
||
|
set nx 1,
|
||
|
set zy 0,
|
||
|
set ny 0,
|
||
|
set f 1,
|
||
|
set no 0,
|
||
|
eval,
|
||
|
output;
|
||
|
|
||
|
set zx 0,
|
||
|
set nx 0,
|
||
|
set zy 0,
|
||
|
set ny 0,
|
||
|
set f 1,
|
||
|
set no 0,
|
||
|
eval,
|
||
|
output;
|
||
|
|
||
|
set zx 0,
|
||
|
set nx 1,
|
||
|
set zy 0,
|
||
|
set ny 0,
|
||
|
set f 1,
|
||
|
set no 1,
|
||
|
eval,
|
||
|
output;
|
||
|
|
||
|
set zx 0,
|
||
|
set nx 0,
|
||
|
set zy 0,
|
||
|
set ny 1,
|
||
|
set f 1,
|
||
|
set no 1,
|
||
|
eval,
|
||
|
output;
|
||
|
|
||
|
set zx 0,
|
||
|
set nx 0,
|
||
|
set zy 0,
|
||
|
set ny 0,
|
||
|
set f 0,
|
||
|
set no 0,
|
||
|
eval,
|
||
|
output;
|
||
|
|
||
|
set zx 0,
|
||
|
set nx 1,
|
||
|
set zy 0,
|
||
|
set ny 1,
|
||
|
set f 0,
|
||
|
set no 1,
|
||
|
eval,
|
||
|
output;
|