[Solved] Can't implement tests that are too complex

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Solved] Can't implement tests that are too complex

DamienCassou
This post was updated on .
For project 07, I wanted to have a test that would check for all operations (eq, gt, lt, and, or, add, sub...). So, I'm writing a MyTest.tst file that contains something like:

output-list RAM[0]%D2.6.2 RAM[256]%D2.6.2 RAM[257]%D2.6.2
            RAM[258]%D2.6.2 RAM[259]%D2.6.2 RAM[260]%D2.6.2 RAM[261]%D2.6.2
            RAM[262]%D2.6.2 RAM[263]%D2.6.2 RAM[264]%D2.6.2 // gt
            RAM[265]%D2.6.2 RAM[266]%D2.6.2 RAM[267]%D2.6.2 RAM[268]%D2.6.2 // and
            RAM[269]%D2.6.2 RAM[270]%D2.6.2 RAM[271]%D2.6.2 // add
            RAM[272]%D2.6.2 RAM[273]%D2.6.2 RAM[274]%D2.6.2 RAM[275]%D2.6.2 // or
            ;

but I get an error message saying there are too many arguments. So, is there a better way to write such a test?

Thank you
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Can't implement tests that are too complex

cadet1620
Administrator
You can split it into two output lines. You need to put output-list commands everywhere you do an output. Here's your output done in project 4's mult.tst.
load Mult.hack,
output-file Mult.out;

set RAM[0] 0,
set RAM[1] 0;
repeat 20 {
  ticktock;
}
output-list RAM[0]%D2.6.2 RAM[256]%D2.6.2 RAM[257]%D2.6.2
            RAM[258]%D2.6.2 RAM[259]%D2.6.2 RAM[260]%D2.6.2 RAM[261]%D2.6.2
            RAM[262]%D2.6.2 RAM[263]%D2.6.2 RAM[264]%D2.6.2 // gt
            ;
output;
output-list RAM[265]%D2.6.2 RAM[266]%D2.6.2 RAM[267]%D2.6.2 RAM[268]%D2.6.2 // and
            RAM[269]%D2.6.2 RAM[270]%D2.6.2 RAM[271]%D2.6.2 // add
            RAM[272]%D2.6.2 RAM[273]%D2.6.2 RAM[274]%D2.6.2 RAM[275]%D2.6.2 // or
            ;
output;

set PC 0,
set RAM[0] 1,
set RAM[1] 0;
repeat 50 {
  ticktock;
}
output-list RAM[0]%D2.6.2 RAM[256]%D2.6.2 RAM[257]%D2.6.2
            RAM[258]%D2.6.2 RAM[259]%D2.6.2 RAM[260]%D2.6.2 RAM[261]%D2.6.2
            RAM[262]%D2.6.2 RAM[263]%D2.6.2 RAM[264]%D2.6.2 // gt
            ;
output;
output-list RAM[265]%D2.6.2 RAM[266]%D2.6.2 RAM[267]%D2.6.2 RAM[268]%D2.6.2 // and
            RAM[269]%D2.6.2 RAM[270]%D2.6.2 RAM[271]%D2.6.2 // add
            RAM[272]%D2.6.2 RAM[273]%D2.6.2 RAM[274]%D2.6.2 RAM[275]%D2.6.2 // or
            ;
output;

--Mark
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Can't implement tests that are too complex

DamienCassou
Thank you very much, you solved my problem. And the output is much easier to compare now. Here is my current file for those interested.

load MyTest.asm,
output-file MyTest.out,
compare-to MyTest.cmp,

set RAM[0] 256,

repeat 10000 {
  ticktock;
}

output-list RAM[0]%D2.6.2 ; // @SP
output;
output-list RAM[256]%D2.6.2 RAM[257]%D2.6.2 RAM[258]%D2.6.2; // eq
output;
output-list RAM[259]%D2.6.2 RAM[260]%D2.6.2 RAM[261]%D2.6.2; // lt
output;
output-list RAM[262]%D2.6.2 RAM[263]%D2.6.2 RAM[264]%D2.6.2; // gt
output;
output-list RAM[265]%D2.6.2 RAM[266]%D2.6.2 RAM[267]%D2.6.2 RAM[268]%D2.6.2; // and
output;
output-list RAM[269]%D2.6.2 RAM[270]%D2.6.2 RAM[271]%D2.6.2; // add
output;
output-list RAM[272]%D2.6.2 RAM[273]%D2.6.2 RAM[274]%D2.6.2 RAM[275]%D2.6.2; // or
output;
Loading...