2010-12-02 20:00:43 +01:00
|
|
|
// DESCRIPTION: Verilator: Verilog Test module
|
|
|
|
|
//
|
2026-01-27 02:24:34 +01:00
|
|
|
// This file ONLY is placed under the Creative Commons Public Domain.
|
|
|
|
|
// SPDX-FileCopyrightText: 2010 Wilson Snyder
|
2020-03-21 16:24:24 +01:00
|
|
|
// SPDX-License-Identifier: CC0-1.0
|
2010-12-02 20:00:43 +01:00
|
|
|
|
2026-03-03 13:21:24 +01:00
|
|
|
module t;
|
2010-12-02 20:00:43 +01:00
|
|
|
|
|
|
|
|
// This isn't a width violation, as +/- 1'b1 is a common idiom
|
|
|
|
|
// that's fairly harmless
|
|
|
|
|
wire [4:0] five = 5'd5;
|
|
|
|
|
wire [4:0] suma = five + 1'b1;
|
|
|
|
|
wire [4:0] sumb = 1'b1 + five;
|
|
|
|
|
wire [4:0] sumc = five - 1'b1;
|
|
|
|
|
|
2022-02-13 21:27:31 +01:00
|
|
|
wire [4:0] neg5 = - five;
|
|
|
|
|
wire [5:0] neg6 = - five;
|
|
|
|
|
|
2026-01-09 06:25:12 +01:00
|
|
|
wire inc = 1'b1;
|
2026-01-10 01:31:30 +01:00
|
|
|
wire dec = 1'b1;
|
2026-01-09 06:25:12 +01:00
|
|
|
wire [4:0] sumd = inc + five;
|
|
|
|
|
wire [4:0] sume = five + inc;
|
2026-01-10 01:31:30 +01:00
|
|
|
wire [4:0] nege = five - dec;
|
|
|
|
|
wire [4:0] nsume = five + inc - dec;
|
|
|
|
|
wire [4:0] nsumf = five - dec + inc;
|
2026-01-09 06:25:12 +01:00
|
|
|
|
2020-01-29 02:10:10 +01:00
|
|
|
// Relatively harmless < or <= compared with something less wide
|
|
|
|
|
localparam [1:0] THREE = 3;
|
|
|
|
|
int a;
|
|
|
|
|
initial for (a = 0; a < THREE; ++a) $display(a);
|
|
|
|
|
initial for (a = 0; a <= THREE; ++a) $display(a);
|
|
|
|
|
|
2010-12-02 20:00:43 +01:00
|
|
|
endmodule
|