File: module2.v

package info (click to toggle)
tkgate 2.1%2Brepack-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 28,384 kB
  • sloc: ansic: 62,300; tcl: 20,345; xml: 2,731; yacc: 1,177; lex: 839; sh: 664; makefile: 180; perl: 39
file content (61 lines) | stat: -rw-r--r-- 1,087 bytes parent folder | download | duplicates (7)
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
module top;
   wire w1,w2;
   reg p,q,r;

   reg [3:0] m,n;
   wire [1:0] s,v;
   wire [7:0] l;

   foo f1 (.z(w1),.b(w2),.a(r));
   foo f2 (w2,p,q);
   bar b1 ({s,v},m,n);
   bar b2 (l[7:4],m,n);

   initial
     begin   
	p = 1'b0; q = 1'b0; r= 1'b0;
	#1 $display("%b = %b ^ %b ^ %b",w1,p,q,r);

	p = 1'b0; q = 1'b1; r= 1'b0;
	#1 $display("%b = %b ^ %b ^ %b",w1,p,q,r);

	p = 1'b1; q = 1'b0; r= 1'b0;
	#1 $display("%b = %b ^ %b ^ %b",w1,p,q,r);

	p = 1'b1; q = 1'b1; r= 1'b0;
	#1 $display("%b = %b ^ %b ^ %b",w1,p,q,r);

	p = 1'b0; q = 1'b0; r= 1'b1;
	#1 $display("%b = %b ^ %b ^ %b",w1,p,q,r);

	p = 1'b0; q = 1'b1; r= 1'b1;
	#1 $display("%b = %b ^ %b ^ %b",w1,p,q,r);

	p = 1'b1; q = 1'b0; r= 1'b1;
	#1 $display("%b = %b ^ %b ^ %b",w1,p,q,r);

	p = 1'b1; q = 1'b1; r= 1'b1;
	#1 $display("%b = %b ^ %b ^ %b",w1,p,q,r);

	m = 3; n = 8;
	#1 $display("%d = %d + %d   l=%h",{s,v},m,n,l);
     end   
endmodule

module foo(z,a,b);
output z;
input a;
input b;

  assign z = a ^ b;

endmodule

module bar(z,a,b);
output [3:0] z;
input [3:0] a;
input [3:0] b;

  assign z = a + b;

endmodule