Skip to content

Commit 2b449c7

Browse files
committed
added new
1 parent c53af0d commit 2b449c7

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

randomization.sv

+30-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,36 @@
11
//randomization in system verilog
22

33
class random ;
4-
rand bit [7:0] a,b ;
4+
rand bit [2:0] a,b ;
5+
task display();
6+
$display(" a =%d , b = %d " , a , b);
7+
endtask
8+
endclass
9+
10+
program main ;
11+
random randd ;
12+
initial
13+
begin
14+
15+
randd = new();
16+
repeat(10)
17+
begin
18+
randd.randomize();
19+
randd.display();
20+
21+
22+
end
23+
24+
25+
end
26+
27+
endprogram
28+
29+
30+
//using randc
31+
32+
class random ;
33+
randc bit [2:0] a,b ;
534
task display();
635
$display(" a =%d , b = %d " , a , b);
736
endtask

0 commit comments

Comments
 (0)