-
Notifications
You must be signed in to change notification settings - Fork 4
/
basic_interface.sv
executable file
·50 lines (38 loc) · 1.19 KB
/
basic_interface.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
interface pkt_interface( input bit clk);
logic [31:0] hdr_in;
logic sop_in;
logic ena_in;
logic [31:00] data0_in;
logic ena_out;
logic sop_out;
logic [31:00] data0_out;
endinterface
module base_interface_device(pkt_interface filter_sig);
always @(posedge filter_sig.clk) begin
if (filter_sig.ena_in) begin
filter_sig.data0_out <= 32'h10101010;
end
end
endmodule
module basic_interface_driver(pkt_interface test_sig);
always @(posedge test_sig.clk) begin
test_sig.ena_in <= 1;
end
endmodule
// simulate me
module basic_interface_tester();
logic clk;
pkt_interface ourInterface(clk);
initial begin
clk = 0;
// send our clock off
forever #50 clk = ~clk;
$display("ending initial block");
end
base_interface_device our_device(
.filter_sig ( ourInterface)
);
basic_interface_driver out_driver(
.test_sig ( ourInterface)
);
endmodule