@@ -56,7 +56,7 @@ entity HostIF is
56
56
CLK : in std_logic ;
57
57
RST : in std_logic ;
58
58
-- OPB
59
- OPB_ABus : in std_logic_vector (31 downto 0 );
59
+ OPB_ABus : in std_logic_vector (11 downto 0 );
60
60
OPB_BE : in std_logic_vector (3 downto 0 );
61
61
OPB_DBus_in : in std_logic_vector (31 downto 0 );
62
62
OPB_RNW : in std_logic ;
@@ -96,32 +96,23 @@ end entity HostIF;
96
96
-- -----------------------------------------------------------------------------
97
97
architecture RTL of HostIF is
98
98
99
- constant C_ENC_START_REG : std_logic_vector (31 downto 0 ) := X"0000_0000" ;
100
- constant C_IMAGE_SIZE_REG : std_logic_vector (31 downto 0 ) := X"0000_0004" ;
101
- constant C_IMAGE_RAM_ACCESS_REG : std_logic_vector (31 downto 0 ) := X"0000_0008" ;
102
- constant C_ENC_STS_REG : std_logic_vector (31 downto 0 ) := X"0000_000C" ;
103
- constant C_COD_DATA_ADDR_REG : std_logic_vector (31 downto 0 ) := X"0000_0010" ;
104
- constant C_ENC_LENGTH_REG : std_logic_vector (31 downto 0 ) := X"0000_0014" ;
105
- constant C_QUANTIZER_RAM_LUM : std_logic_vector (31 downto 0 ) :=
106
- X"0000_01" & "------00" ;
107
- constant C_QUANTIZER_RAM_CHR : std_logic_vector (31 downto 0 ) :=
108
- X"0000_02" & "------00" ;
109
- constant C_IMAGE_RAM : std_logic_vector (31 downto 0 ) :=
110
- X"001" & "------------------00" ;
111
-
112
- constant C_IMAGE_RAM_BASE : unsigned (31 downto 0 ) := X"0010_0000" ;
99
+ constant C_ENC_START_REG : std_logic_vector (11 downto 0 ) := X"000" ;
100
+ constant C_IMAGE_SIZE_REG : std_logic_vector (11 downto 0 ) := X"004" ;
101
+ constant C_IMAGE_RAM_ACCESS_REG : std_logic_vector (11 downto 0 ) := X"008" ;
102
+ constant C_ENC_STS_REG : std_logic_vector (11 downto 0 ) := X"00C" ;
103
+ constant C_COD_DATA_ADDR_REG : std_logic_vector (11 downto 0 ) := X"010" ;
104
+ constant C_ENC_LENGTH_REG : std_logic_vector (11 downto 0 ) := X"014" ;
105
+ constant C_QUANTIZER_RAM_LUM_BASE : std_logic_vector (11 downto 0 ) := X"100" ;
106
+ constant C_QUANTIZER_RAM_CHR_BASE : std_logic_vector (11 downto 0 ) := X"200" ;
113
107
114
108
signal enc_start_reg : std_logic_vector (31 downto 0 );
115
109
signal image_size_reg : std_logic_vector (31 downto 0 );
116
110
signal image_ram_access_reg : std_logic_vector (31 downto 0 );
117
111
signal enc_sts_reg : std_logic_vector (31 downto 0 );
118
112
signal cod_data_addr_reg : std_logic_vector (31 downto 0 );
119
- signal enc_length_reg : std_logic_vector (31 downto 0 );
120
113
121
- signal rd_dval : std_logic ;
122
- signal data_read : std_logic_vector (31 downto 0 );
123
- signal write_done : std_logic ;
124
- signal OPB_select_d : std_logic ;
114
+ signal read_ack : std_logic ;
115
+ signal write_ack : std_logic ;
125
116
126
117
-- -----------------------------------------------------------------------------
127
118
-- Architecture: begin
@@ -143,46 +134,31 @@ begin
143
134
p_read : process (CLK, RST)
144
135
begin
145
136
if RST = '1' then
146
- OPB_DBus_out <= (others => '0' );
147
- rd_dval <= '0' ;
148
- data_read <= (others => '0' );
137
+ read_ack <= '0' ;
138
+ OPB_DBus_out <= (others => '0' );
149
139
elsif CLK'event and CLK = '1' then
150
- rd_dval <= '0' ;
151
-
152
- OPB_DBus_out <= data_read;
153
-
154
- if OPB_select = '1' and OPB_select_d = '0' then
140
+ read_ack <= '0' ;
141
+ if OPB_select = '1' and read_ack = '0' then
155
142
-- only double word transactions are be supported
156
143
if OPB_RNW = '1' and OPB_BE = X"F" then
144
+ read_ack <= '1' ;
157
145
case OPB_ABus is
158
146
when C_ENC_START_REG =>
159
- data_read <= enc_start_reg;
160
- rd_dval <= '1' ;
161
-
147
+ OPB_DBus_out <= enc_start_reg;
162
148
when C_IMAGE_SIZE_REG =>
163
- data_read <= image_size_reg;
164
- rd_dval <= '1' ;
165
-
149
+ OPB_DBus_out <= image_size_reg;
166
150
when C_IMAGE_RAM_ACCESS_REG =>
167
- data_read <= image_ram_access_reg;
168
- rd_dval <= '1' ;
169
-
151
+ OPB_DBus_out <= image_ram_access_reg;
170
152
when C_ENC_STS_REG =>
171
- data_read <= enc_sts_reg;
172
- rd_dval <= '1' ;
173
-
153
+ OPB_DBus_out <= enc_sts_reg;
174
154
when C_COD_DATA_ADDR_REG =>
175
- data_read <= cod_data_addr_reg;
176
- rd_dval <= '1' ;
177
-
155
+ OPB_DBus_out <= cod_data_addr_reg;
178
156
when C_ENC_LENGTH_REG =>
179
- data_read <= enc_length_reg;
180
- rd_dval <= '1' ;
181
-
157
+ OPB_DBus_out(31 downto 24 ) <= (others => '0' );
158
+ OPB_DBus_out(23 downto 0 ) <= num_enc_bytes;
182
159
when others =>
183
- data_read <= (others => '0' );
160
+ OPB_DBus_out <= (others => '0' );
184
161
end case ;
185
-
186
162
end if ;
187
163
end if ;
188
164
end if ;
@@ -195,76 +171,63 @@ begin
195
171
begin
196
172
if RST = '1' then
197
173
qwren <= '0' ;
198
- write_done <= '0' ;
174
+ write_ack <= '0' ;
199
175
enc_start_reg <= (others => '0' );
200
176
image_size_reg <= (others => '0' );
201
177
image_ram_access_reg <= (others => '0' );
202
178
enc_sts_reg <= (others => '0' );
203
179
cod_data_addr_reg <= (others => '0' );
204
- enc_length_reg <= (others => '0' );
205
180
qdata <= (others => '0' );
206
181
qaddr <= (others => '0' );
207
- OPB_select_d <= '0' ;
208
182
sof <= '0' ;
209
183
img_size_wr <= '0' ;
210
184
elsif CLK'event and CLK = '1' then
211
- qwren <= '0' ;
212
- write_done <= '0' ;
213
- sof <= '0' ;
214
- img_size_wr <= '0' ;
215
- OPB_select_d <= OPB_select;
185
+ qwren <= '0' ;
186
+ write_ack <= '0' ;
187
+ sof <= '0' ;
188
+ img_size_wr <= '0' ;
216
189
217
- if OPB_select = '1' and OPB_select_d = '0' then
190
+ if OPB_select = '1' and write_ack = '0' then
218
191
-- only double word transactions are be supported
219
192
if OPB_RNW = '0' and OPB_BE = X"F" then
193
+ write_ack <= '1' ;
220
194
case OPB_ABus is
221
195
when C_ENC_START_REG =>
222
196
enc_start_reg <= OPB_DBus_in;
223
- write_done <= '1' ;
224
197
if OPB_DBus_in(0 ) = '1' then
225
198
sof <= '1' ;
226
199
end if ;
227
200
228
201
when C_IMAGE_SIZE_REG =>
229
202
image_size_reg <= OPB_DBus_in;
230
203
img_size_wr <= '1' ;
231
- write_done <= '1' ;
232
204
233
205
when C_IMAGE_RAM_ACCESS_REG =>
234
206
image_ram_access_reg <= OPB_DBus_in;
235
- write_done <= '1' ;
236
207
237
208
when C_ENC_STS_REG =>
238
209
enc_sts_reg <= (others => '0' );
239
- write_done <= '1' ;
240
210
241
211
when C_COD_DATA_ADDR_REG =>
242
212
cod_data_addr_reg <= OPB_DBus_in;
243
- write_done <= '1' ;
244
213
245
214
when C_ENC_LENGTH_REG =>
246
215
-- enc_length_reg <= OPB_DBus_in;
247
- write_done <= '1' ;
248
216
249
217
when others =>
250
- null ;
218
+ if OPB_ABus(11 downto 8 ) = C_QUANTIZER_RAM_LUM_BASE(11 downto 8 ) then
219
+ qwren <= '1' ;
220
+ qaddr <= '0' & OPB_ABus(qaddr'high + 2 - 1 downto 2 );
221
+ elsif OPB_ABus(11 downto 8 ) = C_QUANTIZER_RAM_CHR_BASE(11 downto 8 ) then
222
+ qwren <= '1' ;
223
+ qaddr <= '1' & OPB_ABus(qaddr'high + 2 - 1 downto 2 );
224
+ end if ;
251
225
end case ;
252
226
253
- if std_match(OPB_ABus, C_QUANTIZER_RAM_LUM) then
254
- qdata <= OPB_DBus_in(qdata'range );
255
- qaddr <= '0' & OPB_ABus(qaddr'high + 2 - 1 downto 2 );
256
- qwren <= '1' ;
257
- write_done <= '1' ;
258
- end if ;
227
+ end if ;
259
228
260
- if std_match(OPB_ABus, C_QUANTIZER_RAM_CHR) then
261
- qdata <= OPB_DBus_in(qdata'range );
262
- qaddr <= '1' & OPB_ABus(qaddr'high + 2 - 1 downto 2 );
263
- qwren <= '1' ;
264
- write_done <= '1' ;
265
- end if ;
229
+ qdata <= OPB_DBus_in(qdata'range );
266
230
267
- end if ;
268
231
end if ;
269
232
270
233
-- special handling of status reg
@@ -274,24 +237,13 @@ begin
274
237
end if ;
275
238
enc_sts_reg(0 ) <= jpeg_busy;
276
239
277
- enc_length_reg <= (others => '0' );
278
- enc_length_reg(num_enc_bytes'range ) <= num_enc_bytes;
279
-
280
240
end if ;
281
241
end process ;
282
242
283
243
-- -----------------------------------------------------------------
284
244
-- transfer ACK
285
245
-- -----------------------------------------------------------------
286
- p_ack : process (CLK, RST)
287
- begin
288
- if RST = '1' then
289
- OPB_XferAck <= '0' ;
290
- elsif CLK'event and CLK = '1' then
291
- OPB_XferAck <= rd_dval or write_done;
292
- end if ;
293
- end process ;
294
-
246
+ OPB_XferAck <= read_ack or write_ack;
295
247
296
248
end architecture RTL ;
297
249
-- -----------------------------------------------------------------------------
0 commit comments