-
Notifications
You must be signed in to change notification settings - Fork 0
/
interface_parameterize.sv
56 lines (40 loc) · 1.19 KB
/
interface_parameterize.sv
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
//---------------------------------------------------
// Paramterized interface example
//---------------------------------------------------
interface simple_bus#(ADDR_WIDTH=8 ,DATA_WIDTH=16) (input bit clk);
logic req,gnt ;
logic start,rdy;
logic [1:0] mode ;
logic [ADDR_WIDTH-1:0] addr;
logic [DATA_WIDTH-1:0] data;
endinterface
//----------------------------------------------------
// memory module use wide inteface
//----------------------------------------------------
module memmod(interface a);
logic mem_en;
endmodule
//----------------------------------------------------
// cpu module use simple_bus interface
//----------------------------------------------------
module cpumod(interface b);
logic cpu_en;
endmodule
//------------------------------------------
// top module
//------------------------------------------
module top;
logic clk=0;
always #10 clk = ~clk ;
simple_bus sb_intf(clk);
simple_bus #((32),(64)) wide_intf(clk) ;
memmod u_mem(wide_intf);
cpumod u_cpu(sb_intf);
initial
begin
$dumpfile("dump.vcd");
$dumpvars();
#500;
$finish();
end
endmodule