Hi all,
Here is my code in which I am trying to concatenate a and b into c but not able to do so. Please help.
My code:
class abc;
rand bit [1:0] a;
rand bit [1:0] b;
bit [3:0] c;
//bit c = {a,b};
constraint A { a[1] == 1; a[0] == 0;}
constraint B { b [1] ==1;}
bit [3:0] c = {a,b};
/*function void display();
$display("a = %b", a);
$display("b = %b", b);
endfunction*/
function void displayA();
$display("c = %b", c);
endfunction
endclass
module tb;
initial begin
repeat (3) begin
abc xyz;
xyz = new();
xyz.randomize();
//xyz.display();
xyz.displayA();
end
end
endmodule