3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-04-23 17:15:33 +00:00
This commit is contained in:
Zachary Snow 2025-03-31 13:02:33 +00:00 committed by GitHub
commit 4b5cbbc6dd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 84 additions and 10 deletions

View file

@ -5,9 +5,17 @@ module producer(
endmodule
module top(
output logic [3:0] out
output logic [3:0] out0, out1, out2, out3
);
logic [3:0] v[0:0];
producer p(v[0]);
assign out = v[0];
logic [3:0] v[1:0];
logic [1:0] u[1:0];
logic [1:0] t[1:0];
producer p0(v[0]);
producer p1({v[1]});
producer p2({u[1], u[0]});
producer p3({{t[1]}, {t[0]}});
assign out0 = v[0];
assign out1 = v[1];
assign out2 = {u[1], u[0]};
assign out3 = {t[1], t[0]};
endmodule

View file

@ -0,0 +1,45 @@
`define OUTPUTS(mode) \
o``mode``0, \
o``mode``1, \
o``mode``2, \
o``mode``3, \
o``mode``4
module gate(
input [1:0] iu,
input signed [1:0] is,
output [2:0] `OUTPUTS(u),
output signed [2:0] `OUTPUTS(s)
);
`define INSTANCES(mode) \
mod m``mode``0({i``mode}, {o``mode``0}); \
mod m``mode``1($unsigned(i``mode), o``mode``1); \
mod m``mode``2({i``mode[1:0]}, o``mode``2); \
mod m``mode``3({$signed(i``mode)}, o``mode``3); \
mod m``mode``4($unsigned({i``mode}), o``mode``4);
`INSTANCES(u)
`INSTANCES(s)
`undef INSTANCES
endmodule
module gold(
input [1:0] iu, is,
output [2:0] `OUTPUTS(u), `OUTPUTS(s)
);
`define INSTANCES(mode) \
assign o``mode``0 = i``mode; \
assign o``mode``1 = i``mode; \
assign o``mode``2 = i``mode; \
assign o``mode``3 = i``mode; \
assign o``mode``4 = i``mode;
`INSTANCES(u)
`INSTANCES(s)
`undef INSTANCES
endmodule
module mod(
input [2:0] inp,
output [2:0] out
);
assign out = inp;
endmodule

View file

@ -0,0 +1,7 @@
read_verilog signed_concat.v
hierarchy
proc
flatten gate
equiv_make gold gate equiv
equiv_simple
equiv_status -assert