R
Robert Willy
Guest
Hi,
I remember that there is a configuration structure in VHDL, i.e. select a architecture for an entity. Is there a similar structure in Verilog?
For example, there are two modules here. I want to use one based on a selection.
Thanks,
module regwrite(
output reg [3:0] rout,
input clk, in,
input [3:0] ctrl);
always @(posedge clk)
if(ctrl[0]) rout[0] <= in;
else if(ctrl[1]) rout[1] <= in;
else if(ctrl[2]) rout[2] <= in;
else if(ctrl[3]) rout[3] <= in;
endmodule
module regwrite(
output reg [3:0] rout,
input clk, in,
input [3:0] ctrl);
always @(posedge clk) begin
if(ctrl[0]) rout[0] <= in;
if(ctrl[1]) rout[1] <= in;
if(ctrl[2]) rout[2] <= in;
if(ctrl[3]) rout[3] <= in;
end
endmodule
I remember that there is a configuration structure in VHDL, i.e. select a architecture for an entity. Is there a similar structure in Verilog?
For example, there are two modules here. I want to use one based on a selection.
Thanks,
module regwrite(
output reg [3:0] rout,
input clk, in,
input [3:0] ctrl);
always @(posedge clk)
if(ctrl[0]) rout[0] <= in;
else if(ctrl[1]) rout[1] <= in;
else if(ctrl[2]) rout[2] <= in;
else if(ctrl[3]) rout[3] <= in;
endmodule
module regwrite(
output reg [3:0] rout,
input clk, in,
input [3:0] ctrl);
always @(posedge clk) begin
if(ctrl[0]) rout[0] <= in;
if(ctrl[1]) rout[1] <= in;
if(ctrl[2]) rout[2] <= in;
if(ctrl[3]) rout[3] <= in;
end
endmodule