`timescale 1ns/1ns
module function_mod(
input [3:0]a,
input [3:0]b,
output [3:0]c,
output [3:0]d
);
turn turn_a(a,c);
turn turn_b(b,d);
endmodule
module turn(
input [3:0] a,
output [3:0] c
);
genvar i;
generate
for (i = 0; i < 4; i = i + 1) begin: reverse
assign c[i] = a[3-i];
end
endgenerate
endmodule
`timescale 1ns/1ns
module function_mod(
input [3:0]a,
input [3:0]b,
output [3:0]c,
output [3:0]d
);
function [3:0] rev;
input [3:0] in;
integer i;
for (i=0; i<4;i=i+1) begin
rev[i] = in[3-i];
end
endfunction
assign c=rev(a);
assign d=rev(b);
endmodule