@@ -27,7 +27,7 @@ module usbf_pd( clk, rst,
27
27
input clk, rst;
28
28
29
29
// UTMI RX Interface
30
- input [7 :0 ] rx_data;
30
+ input [4 :0 ] rx_data;
31
31
input rx_valid, rx_active, rx_err;
32
32
33
33
// Decoded PIDs (used when token_valid is asserted)
@@ -38,13 +38,13 @@ output pid_PRE, pid_ERR, pid_SPLIT, pid_PING;
38
38
output pid_cks_err; // Indicates a PID checksum error
39
39
40
40
41
- output [6 :0 ] token_fadr; // Function address from token
42
- output [3 :0 ] token_endp; // Endpoint number from token
41
+ output [4 :0 ] token_fadr; // Function address from token
42
+ output [2 :0 ] token_endp; // Endpoint number from token
43
43
output token_valid; // Token is valid
44
44
output crc5_err; // Token crc5 error
45
- output [10 :0 ] frame_no; // Frame number for SOF tokens
45
+ output [4 :0 ] frame_no; // Frame number for SOF tokens
46
46
47
- output [7 :0 ] rx_data_st; // Data to memory store unit
47
+ output [4 :0 ] rx_data_st; // Data to memory store unit
48
48
output rx_data_valid; // Data on rx_data_st is valid
49
49
output rx_data_done; // Indicates end of a transfer
50
50
output crc16_err; // Data packet CRC 16 error
@@ -56,16 +56,16 @@ output seq_err; // State Machine Sequence Error
56
56
// Local Wires and Registers
57
57
//
58
58
59
- parameter [3 :0 ] // synopsys enum state
59
+ parameter [2 :0 ] // synopsys enum state
60
60
IDLE = 4'b0001 ,
61
61
ACTIVE = 4'b0010 ,
62
62
TOKEN = 4'b0100 ,
63
63
DATA = 4'b1000 ;
64
64
65
- reg [3 :0 ] /* synopsys enum state */ state, next_state;
65
+ reg [2 :0 ] /* synopsys enum state */ state, next_state;
66
66
// synopsys state_vector state
67
67
68
- reg [7 :0 ] pid; // Packet PDI
68
+ reg [4 :0 ] pid; // Packet PDI
69
69
reg pid_le_sm; // PID Load enable from State Machine
70
70
wire pid_ld_en; // Enable loading of PID (all conditions)
71
71
wire pid_cks_err; // Indicates a pid checksum err
@@ -78,11 +78,11 @@ wire pid_PRE, pid_ERR, pid_SPLIT, pid_PING, pid_RES;
78
78
wire pid_TOKEN; // All TOKEN packet that we recognize
79
79
wire pid_DATA; // All DATA packets that we recognize
80
80
81
- reg [7 :0 ] token0, token1; // Token Registers
81
+ reg [4 :0 ] token0, token1; // Token Registers
82
82
reg token_le_1, token_le_2; // Latch enables for token storage registers
83
83
wire [4 :0 ] token_crc5;
84
84
85
- reg [7 :0 ] d0, d1, d2; // Data path delay line (used to filter out crcs)
85
+ reg [4 :0 ] d0, d1, d2; // Data path delay line (used to filter out crcs)
86
86
reg data_valid_d; // Data Valid output from State Machine
87
87
reg data_done; // Data cycle complete output from State Machine
88
88
reg data_valid0; // Data valid delay line
@@ -101,8 +101,8 @@ reg rx_active_r;
101
101
wire [4 :0 ] crc5_out;
102
102
wire [4 :0 ] crc5_out2;
103
103
wire crc16_clr;
104
- reg [15 :0 ] crc16_sum;
105
- wire [15 :0 ] crc16_out;
104
+ reg [4 :0 ] crc16_sum;
105
+ wire [4 :0 ] crc16_out;
106
106
107
107
// /////////////////////////////////////////////////////////////////
108
108
//
@@ -123,23 +123,23 @@ always @(posedge clk)
123
123
124
124
assign pid_cks_err = (pid[3 :0 ] != ~ pid[7 :4 ]);
125
125
126
- assign pid_OUT = pid[3 :0 ] == `USBF_T_PID_OUT;
127
- assign pid_IN = pid[3 :0 ] == `USBF_T_PID_IN;
128
- assign pid_SOF = pid[3 :0 ] == `USBF_T_PID_SOF;
129
- assign pid_SETUP = pid[3 :0 ] == `USBF_T_PID_SETUP;
130
- assign pid_DATA0 = pid[3 :0 ] == `USBF_T_PID_DATA0;
131
- assign pid_DATA1 = pid[3 :0 ] == `USBF_T_PID_DATA1;
132
- assign pid_DATA2 = pid[3 :0 ] == `USBF_T_PID_DATA2;
133
- assign pid_MDATA = pid[3 :0 ] == `USBF_T_PID_MDATA;
134
- assign pid_ACK = pid[3 :0 ] == `USBF_T_PID_ACK;
135
- assign pid_NACK = pid[3 :0 ] == `USBF_T_PID_NACK;
136
- assign pid_STALL = pid[3 :0 ] == `USBF_T_PID_STALL;
137
- assign pid_NYET = pid[3 :0 ] == `USBF_T_PID_NYET;
138
- assign pid_PRE = pid[3 :0 ] == `USBF_T_PID_PRE;
139
- assign pid_ERR = pid[3 :0 ] == `USBF_T_PID_ERR;
140
- assign pid_SPLIT = pid[3 :0 ] == `USBF_T_PID_SPLIT;
141
- assign pid_PING = pid[3 :0 ] == `USBF_T_PID_PING;
142
- assign pid_RES = pid[3 :0 ] == `USBF_T_PID_RES;
126
+ assign pid_OUT = pid[2 :0 ] == `USBF_T_PID_OUT;
127
+ assign pid_IN = pid[2 :0 ] == `USBF_T_PID_IN;
128
+ assign pid_SOF = pid[2 :0 ] == `USBF_T_PID_SOF;
129
+ assign pid_SETUP = pid[2 :0 ] == `USBF_T_PID_SETUP;
130
+ assign pid_DATA0 = pid[2 :0 ] == `USBF_T_PID_DATA0;
131
+ assign pid_DATA1 = pid[2 :0 ] == `USBF_T_PID_DATA1;
132
+ assign pid_DATA2 = pid[2 :0 ] == `USBF_T_PID_DATA2;
133
+ assign pid_MDATA = pid[2 :0 ] == `USBF_T_PID_MDATA;
134
+ assign pid_ACK = pid[2 :0 ] == `USBF_T_PID_ACK;
135
+ assign pid_NACK = pid[2 :0 ] == `USBF_T_PID_NACK;
136
+ assign pid_STALL = pid[2 :0 ] == `USBF_T_PID_STALL;
137
+ assign pid_NYET = pid[2 :0 ] == `USBF_T_PID_NYET;
138
+ assign pid_PRE = pid[2 :0 ] == `USBF_T_PID_PRE;
139
+ assign pid_ERR = pid[2 :0 ] == `USBF_T_PID_ERR;
140
+ assign pid_SPLIT = pid[2 :0 ] == `USBF_T_PID_SPLIT;
141
+ assign pid_PING = pid[2 :0 ] == `USBF_T_PID_PING;
142
+ assign pid_RES = pid[2 :0 ] == `USBF_T_PID_RES;
143
143
144
144
assign pid_TOKEN = pid_OUT | pid_IN | pid_SOF | pid_SETUP | pid_PING;
145
145
assign pid_DATA = pid_DATA0 | pid_DATA1 | pid_DATA2 | pid_MDATA;
0 commit comments