module top_module (
input [4:0] a, b, c, d, e, f,
output [7:0] w, x, y, z );//
// assign { ... } = { ... };
assign {w[7:0],x[7:0],y[7:0],z[7:0]}= {{a[4:0],b[4:0]},{c[4:0],d[4:0]},{e[4:0],f[4:0]},{2'b11}};
endmodule
vector reversal 1
module top_module(
input [7:0] in,
output reg [7:0] out
);
integer i;
always @(*)begin
for (i=0;i<8;i=i+1)begin
out[i]=in[7-i];
end
end
endmodule
Replication operator
module top_module (
input [7:0] in,
output [31:0] out );//
// assign out = { replicate-sign-bit , the-input };
assign out = {{24{in[7]}},in};
endmodule
More replication
module top_module (
input a, b, c, d, e,
output [24:0] out );//
// The output is XNOR of two vectors created by
// concatenating and replicating the five inputs.
// assign out = ~{ ... } ^ { ... };
assign out = ~{{5{a}},{5{b}},{5{c}},{5{d}},{5{e}}}^{5{{a,b,c,d,e}}};
endmodule