3
0
Fork 0
mirror of https://github.com/YosysHQ/sby.git synced 2025-04-06 14:24:08 +00:00
sby/docs/examples/puzzles/primegen.sv
Clifford Wolf c5e5f5dcbb Update examples
Signed-off-by: Clifford Wolf <clifford@clifford.at>
2018-06-29 19:32:03 +02:00

28 lines
602 B
Systemverilog

module primegen;
(* anyconst *) reg [31:0] prime;
(* allconst *) reg [15:0] factor;
always @* begin
if (1 < factor && factor < prime)
assume ((prime % factor) != 0);
assume (prime > 1000000000);
cover (1);
end
endmodule
module primes;
parameter [8:0] offset = 500;
(* anyconst *) reg [8:0] prime1;
wire [9:0] prime2 = prime1 + offset;
(* allconst *) reg [4:0] factor;
always @* begin
if (1 < factor && factor < prime1)
assume ((prime1 % factor) != 0);
if (1 < factor && factor < prime2)
assume ((prime2 % factor) != 0);
assume (1 < prime1);
cover (1);
end
endmodule