So, I have some old test files sitting in the repo. No sense in letting good test files go to waste, need to triage and determine which ones are good, which ones are completely nonsensical, and which ones represent a need for additional functionality:
### CODE
module duplicate_variable(bits<4> a) -> (bits<4> a) {
a[t] = a[t];
}
### OUTPUT
// Should error
### CODE
module if_compound_condition(bit a, bit b, bit c) -> (bit all) {
if a[t] && b[t] && c[t] {
all[t] = 1;
} else {
all[t] = 0;
}
}
### DATA
rst,a in 1,b in 1,c in 1,all out 1
1,0,0,0,0
0,1,0,0,0
0,1,1,1,1
0,1,0,1,0
### CODE
module shifter(bits<4> a) -> (bits<4> b) {
b[t] = a[t][2:0] ++ 1'd0;
}
module instantiation_time(bits<4> a) -> (bits<4> b) {
my_shifter.a[t] = a[t-1];
b[t] = my_shifter.b[t-1];
instantiate shifter as my_shifter;
}
### DATA
rst,a in 4,b out 4
1,0,x
0,1,x
0,2,x
0,3,2
0,12,4
0,x,6
0,x,8
This one almost certainly does not have the correct output. I think in general terms the code should work fine:
### CODE
module typecheck_reset() -> (bit a) {
a[0] = 16'd0;
a[t] = ~a[t-1];
}
### OUTPUT
Mismatched types: provided `bits<2>` but should have been `bits<1>` on line 3 col 16:
a_out[t] = b[t];
^
Mismatched types: provided `bits<2>` but should have been `bits<1>` on line 4 col 21:
b_out[t] = b[t] + a[t];
^
I think there's multiple errors for each module in this one:
### CODE
module unset_result(bit a) -> (bit b) {
//
}
module unset_instantiated_input(bit a) -> (bit b) {
instantiate unset_result as child;
b[t] = a[t];
}
struct twobits {
bit bit0;
bit bit1;
}
module unset_partial_result_struct(bit a, bit b) -> (twobits result) {
result.bit0[t] = a[t];
}
### OUTPUT
Should throw three errors
So, I have some old test files sitting in the repo. No sense in letting good test files go to waste, need to triage and determine which ones are good, which ones are completely nonsensical, and which ones represent a need for additional functionality:
This one almost certainly does not have the correct output. I think in general terms the code should work fine:
I think there's multiple errors for each module in this one: