Assignment Array
Assignment Array
Assignment
Answer:reg[63:0]mem[127:0];
Answer: reg[15:0]mem[63:0];
Initial begin
for(index =0;index<=7;index=index+1)
data_out[index]<=1;
end
4) Write a code to initialize all values to zero and print all those values after
initialization
intA[i] = $urandom_range(50-59);
Task to complete
6) Declare another integer array copy the first array element to another and then
compare the both the elements
7) In the above code insert a task called print array () to print the array elements
8) Assign array elements with a random values b/w 1.5-2.5
9) Declare an array with random values assigned without repetition of values
10) Assign a random values b/w 30 to 60 without using $urandom_range.
Discussion questions
and(carry,a,b);
endmodule
always @(*)
begin
carry=a&b;
end
endmodule
assign c=a&b;
endmodule
4. represent wdata(size is 10 bits) with value 578 using 10bit size in all
radix format?
Answer:
(578)10=¿
( 578 )10 =( 1001000010 ) 2
( 578 )10 =(1102)8
16-07-2025
Theory Section
Agenda:
Seed in $random
String
Hierarchal modelling
Seed in $random
Without using seed same some set of random values will show the output
how many times you run the code, by using seed it will generate the different
random values.
Integer a;
integer seed;
initial begin
$value$plusargs(“seed=%d”,seed);
Repeat(10) begin
a=$random(seed);
$display(“a=%d”,a);
end
end
endmodule
String
Verilog is static on nature, size once declared can’t be changed during the
execution. Essentially string in Verilog is reg vector which is compulsory
multiple of 8.