2019-12-01 23:19:03 +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: 2019 Wilson Snyder
|
2020-03-21 16:24:24 +01:00
|
|
|
// SPDX-License-Identifier: CC0-1.0
|
2019-12-01 23:19:03 +01:00
|
|
|
|
|
|
|
|
function automatic integer min(input integer a, input integer b);
|
2026-03-08 23:26:40 +01:00
|
|
|
return (a < b) ? a : b;
|
2019-12-01 23:19:03 +01:00
|
|
|
endfunction
|
|
|
|
|
|
2026-03-08 23:26:40 +01:00
|
|
|
module t #(
|
|
|
|
|
parameter A = 16,
|
|
|
|
|
parameter B = 8
|
|
|
|
|
) ( /*AUTOARG*/
|
|
|
|
|
// Outputs
|
|
|
|
|
c,
|
|
|
|
|
// Inputs
|
|
|
|
|
a,
|
|
|
|
|
b
|
|
|
|
|
);
|
2019-12-01 23:19:03 +01:00
|
|
|
|
2026-03-08 23:26:40 +01:00
|
|
|
input [A-1:0] a;
|
|
|
|
|
input [B-1:0] b;
|
|
|
|
|
output logic [min(A,B)-1:0] c;
|
2019-12-01 23:19:03 +01:00
|
|
|
|
2026-03-08 23:26:40 +01:00
|
|
|
always_comb for (int i = 0; i < min(A, B); i++) assign c[i] = a[i] | b[i];
|
2019-12-01 23:19:03 +01:00
|
|
|
|
|
|
|
|
endmodule
|