1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
| interface score_if;
integer if_age;
integer if_iq;
integer if_shoesize;
endinterface // score_if
module dut(score_if this_if,
output integer out_score
);
always@(*) begin
out_score= (this_if.if_age *
this_if.if_iq *
this_if.if_shoesize)
%101;
end
endmodule
module stimulus(score_if the_if);
initial begin
repeat (3) begin
the_if.if_age = $urandom;
the_if.if_iq = $urandom;
the_if.if_shoesize = $urandom;
#10;
end
end
endmodule
module top;
integer dut_score;
score_if that_if();
stimulus stimulus( .the_if(that_if)
);
dut dut( .this_if(that_if),
.out_score(dut_score)
);
initial begin
$monitor($time, " new score is: %0d", dut_score);
end
endmodule
|