Formal verification cells

Note

Some front-ends may not support the generic $check cell, in such cases calling chformal -lower will convert each $check cell into it’s equivalent. See chformal for more.

yosys> help $allconst
Simulation model (verilog)
Listing 228 simlib.v
2206module \$allconst (Y);
2207
2208    parameter WIDTH = 0;
2209
2210    output [WIDTH-1:0] Y;
2211
2212    assign Y = 'bx;
2213
2214endmodule
yosys> help $allseq
Simulation model (verilog)
Listing 229 simlib.v
2219module \$allseq (Y);
2220
2221    parameter WIDTH = 0;
2222
2223    output [WIDTH-1:0] Y;
2224
2225    assign Y = 'bx;
2226
2227endmodule
yosys> help $anyconst
Simulation model (verilog)
Listing 230 simlib.v
2159module \$anyconst (Y);
2160
2161    parameter WIDTH = 0;
2162
2163    output [WIDTH-1:0] Y;
2164
2165    assign Y = 'bx;
2166
2167endmodule
yosys> help $anyinit
Simulation model (verilog)
Listing 231 simlib.v
2188module \$anyinit (D, Q);
2189
2190    parameter WIDTH = 0;
2191
2192    input [WIDTH-1:0] D;
2193    output reg [WIDTH-1:0] Q;
2194
2195    initial Q <= 'bx;
2196
2197    always @(`SIMLIB_GLOBAL_CLOCK) begin
2198        Q <= D;
2199    end
2200
2201endmodule
yosys> help $anyseq
Simulation model (verilog)
Listing 232 simlib.v
2172module \$anyseq (Y);
2173
2174    parameter WIDTH = 0;
2175
2176    output [WIDTH-1:0] Y;
2177
2178    assign Y = 'bx;
2179
2180endmodule
yosys> help $assert
Simulation model (verilog)
Listing 233 simlib.v
2078module \$assert (A, EN);
2079
2080    input A, EN;
2081
2082    `ifndef SIMLIB_NOCHECKS
2083    always @* begin
2084        if (A !== 1'b1 && EN === 1'b1) begin
2085            $display("Assertion %m failed!");
2086            $stop;
2087        end
2088    end
2089    `endif
2090
2091endmodule
yosys> help $assume
Simulation model (verilog)
Listing 234 simlib.v
2096module \$assume (A, EN);
2097
2098    input A, EN;
2099
2100    `ifndef SIMLIB_NOCHECKS
2101    always @* begin
2102        if (A !== 1'b1 && EN === 1'b1) begin
2103            $display("Assumption %m failed!");
2104            $stop;
2105        end
2106    end
2107    `endif
2108
2109endmodule
yosys> help $cover
Simulation model (verilog)
Listing 235 simlib.v
2132module \$cover (A, EN);
2133
2134    input A, EN;
2135
2136endmodule
yosys> help $equiv
Simulation model (verilog)
Listing 236 simlib.v
2232module \$equiv (A, B, Y);
2233
2234    input A, B;
2235    output Y;
2236
2237    assign Y = (A !== 1'bx && A !== B) ? 1'bx : A;
2238
2239    `ifndef SIMLIB_NOCHECKS
2240    always @* begin
2241        if (A !== 1'bx && A !== B) begin
2242            $display("Equivalence failed!");
2243            $stop;
2244        end
2245    end
2246    `endif
2247
2248endmodule
yosys> help $fair
Simulation model (verilog)
Listing 237 simlib.v
2123module \$fair (A, EN);
2124
2125    input A, EN;
2126
2127endmodule
yosys> help $ff
Simulation model (verilog)
Listing 238 simlib.v
2329module \$ff (D, Q);
2330
2331    parameter WIDTH = 0;
2332
2333    input [WIDTH-1:0] D;
2334    output reg [WIDTH-1:0] Q;
2335
2336    always @(`SIMLIB_GLOBAL_CLOCK) begin
2337        Q <= D;
2338    end
2339
2340endmodule
yosys> help $initstate
Simulation model (verilog)
Listing 239 simlib.v
2141module \$initstate (Y);
2142
2143    output reg Y = 1;
2144    reg [3:0] cnt = 1;
2145    reg trig = 0;
2146
2147    initial trig <= 1;
2148
2149    always @(cnt, trig) begin
2150        Y <= |cnt;
2151        cnt <= cnt + |cnt;
2152    end
2153
2154endmodule
yosys> help $live
Simulation model (verilog)
Listing 240 simlib.v
2114module \$live (A, EN);
2115
2116    input A, EN;
2117
2118endmodule

Formal support cells

yosys> help $future_ff
Simulation model (verilog)
Listing 241 simlib.v
3231module \$future_ff (A, Y);
3232
3233    parameter WIDTH = 0;
3234
3235    input [WIDTH-1:0] A;
3236    output [WIDTH-1:0] Y;
3237
3238    assign Y = A;
3239
3240endmodule
yosys> help $get_tag
Simulation model (verilog)
Listing 242 simlib.v
3190module \$get_tag (A, Y);
3191
3192    parameter TAG = "";
3193    parameter WIDTH = 0;
3194
3195    input [WIDTH-1:0] A;
3196    output [WIDTH-1:0] Y;
3197
3198    assign Y = A;
3199
3200endmodule
yosys> help $original_tag
Simulation model (verilog)
Listing 243 simlib.v
3217module \$original_tag (A, Y);
3218
3219    parameter TAG = "";
3220    parameter WIDTH = 0;
3221
3222    input [WIDTH-1:0] A;
3223    output [WIDTH-1:0] Y;
3224
3225    assign Y = A;
3226
3227endmodule
yosys> help $overwrite_tag
Simulation model (verilog)
Listing 244 simlib.v
3204module \$overwrite_tag (A, SET, CLR);
3205
3206    parameter TAG = "";
3207    parameter WIDTH = 0;
3208
3209    input [WIDTH-1:0] A;
3210    input [WIDTH-1:0] SET;
3211    input [WIDTH-1:0] CLR;
3212
3213endmodule
yosys> help $set_tag
Simulation model (verilog)
Listing 245 simlib.v
3174module \$set_tag (A, SET, CLR, Y);
3175
3176    parameter TAG = "";
3177    parameter WIDTH = 0;
3178
3179    input [WIDTH-1:0] A;
3180    input [WIDTH-1:0] SET;
3181    input [WIDTH-1:0] CLR;
3182    output [WIDTH-1:0] Y;
3183
3184    assign Y = A;
3185
3186endmodule