-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhpi_io_intf.sv
40 lines (37 loc) · 992 Bytes
/
hpi_io_intf.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
module hpi_io_intf( input [1:0] from_sw_address,
output[15:0] from_sw_data_in,
input [15:0] from_sw_data_out,
input from_sw_r,from_sw_w,from_sw_cs,
inout [15:0] OTG_DATA,
output[1:0] OTG_ADDR,
output OTG_RD_N, OTG_WR_N, OTG_CS_N, OTG_RST_N,
input OTG_INT, Clk, Reset);
logic [15:0] tmp_data;
logic from_sw_int;
//Fill in the blanks below.
assign OTG_RST_N = ~Reset;
assign OTG_DATA = from_sw_w==0 ? tmp_data : 16'hzzzz;
always_ff @ (posedge Clk or posedge Reset)
begin
if(Reset)
begin
tmp_data <= 16'h0000;
OTG_ADDR <= 2'b00;
OTG_RD_N <= 1'b1;
OTG_WR_N <= 1'b1;
OTG_CS_N <= 1'b1;
from_sw_data_in<= 16'h0000;
from_sw_int <= 1'b0;
end
else
begin
tmp_data <= from_sw_data_out;
OTG_ADDR <= from_sw_address;
OTG_RD_N <= from_sw_r;
OTG_WR_N <= from_sw_w;
OTG_CS_N <= from_sw_cs;
from_sw_data_in <= OTG_DATA;
from_sw_int <= OTG_INT;
end
end
endmodule