How can I invert the output D bitwise in Verilog without modifying the original source file, and then output a new Verilog file #5147
-
Is there a direct command to do this? Or should I add a wire? Or should I write another module and connect the two together? |
Beta Was this translation helpful? Give feedback.
Answered by
KrystalDelusion
May 27, 2025
Replies: 1 comment
-
Provided the output you want to invert is connected to a wire (and not being directly driven as the output of a cell), you can do something like module top(input [3:0] a, b, output [3:0] d);
wire [3:0] d_temp;
some_mod some_inst(.x(a), .y(b), .z(d));
assign d = d_temp;
endmodule
The other option would be to write a wrapper module (and optionally rename the original so that your new top module is still called the same thing).
|
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
yujning
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Provided the output you want to invert is connected to a wire (and not being directly driven as the output of a cell), you can do something like
in.v
yosys -p 'read_verilog in.v; insbuf -buf $_NOT_ A Y w:d; write_verilog -noattr out.v'
and get
out.v