[Bug] HardwareSimulator comparing fails when formatting is not identical

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

[Bug] HardwareSimulator comparing fails when formatting is not identical

smoneck
The comparing mechanism of the HardwareSimulator fails when the formatting of the .cmp file is not identical.


= = = = = Minimal working example = = = = =


The following configuration works as expected.

AndMuxOr.hdl
CHIP AndMuxOr {
    IN a, b, sel;
    OUT out;

    PARTS:
    And (a=a, b=b, out=andOut);
    Or (a=a, b=b, out=orOut);
    Mux (a=andOut, b=orOut, sel=sel, out=out);                          
}

AndMuxOr.tst
load AndMuxOr.hdl,                                                      
output-file AndMuxOr.out,
compare-to AndMuxOr.cmp,
output-list a b sel out;
set a 0, set b 0, set sel 0, eval, output;
set a 0, set b 0, set sel 1, eval, output;
set a 0, set b 1, set sel 0, eval, output;
set a 0, set b 1, set sel 1, eval, output;
set a 1, set b 0, set sel 0, eval, output;
set a 1, set b 0, set sel 1, eval, output;
set a 1, set b 1, set sel 0, eval, output;
set a 1, set b 1, set sel 1, eval, output;

AndMuxOr.cmp
| a | b |sel|out|                                                        
| 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 0 |
| 0 | 1 | 0 | 0 |
| 0 | 1 | 1 | 1 |
| 1 | 0 | 0 | 0 |
| 1 | 0 | 1 | 1 |
| 1 | 1 | 0 | 1 |
| 1 | 1 | 1 | 1 |

= = = = = = = = = = = = = = = =  = = = = =

Altering the latter to (what is way more convenient to produce using [1])

|a|b|sel|out|
|0|0|0|0|                                                                
|0|0|1|0|
|0|1|0|0|
|0|1|1|1|
|1|0|0|0|
|1|0|1|1|
|1|1|0|1|
|1|1|1|1|

fails with comparison failure at line 1.

I recommend altering the comparison mechanism to something like the ''.join(string.split()) operation in python.


Thanks a lot!

Cheers,
Stephan


[1] echo \|a\|b\|sel\|out\|;for i in {0..1}{0..1}{0..1};do echo \|${i:0:1}\|${i:1:1}\|${i:2:2}\|\|;done and fill out the blanks.
Loading...