Line 74... |
Line 74... |
signal rd_cnt : unsigned(5 downto 0);
|
signal rd_cnt : unsigned(5 downto 0);
|
signal rd_en : std_logic;
|
signal rd_en : std_logic;
|
|
|
signal divalid : STD_LOGIC;
|
signal divalid : STD_LOGIC;
|
signal zrl_proc : std_logic;
|
signal zrl_proc : std_logic;
|
signal zrl_proc_d1 : std_logic;
|
|
signal zrl_di : STD_LOGIC_VECTOR(RAMDATA_W-1 downto 0);
|
signal zrl_di : STD_LOGIC_VECTOR(RAMDATA_W-1 downto 0);
|
begin
|
begin
|
|
|
size <= STD_LOGIC_VECTOR(size_reg);
|
size <= STD_LOGIC_VECTOR(size_reg);
|
amplitude <= STD_LOGIC_VECTOR(ampli_vli_reg(11 downto 0));
|
amplitude <= STD_LOGIC_VECTOR(ampli_vli_reg(11 downto 0));
|
|
|
rd_addr <= STD_LOGIC_VECTOR(rd_cnt);
|
rd_addr <= STD_LOGIC_VECTOR(rd_cnt);
|
|
|
-------------------------------------------
|
-------------------------------------------
|
-- Counter1
|
|
-------------------------------------------
|
|
process(clk,rst)
|
|
begin
|
|
if rst = '1' then
|
|
rd_en <= '0';
|
|
rd_cnt <= (others => '0');
|
|
elsif clk = '1' and clk'event then
|
|
if start_pb = '1' then
|
|
rd_cnt <= (others => '0');
|
|
rd_en <= '1';
|
|
end if;
|
|
|
|
-- input read enable
|
|
if rd_en = '1' and zrl_proc = '0' then
|
|
if rd_cnt = 64-1 then
|
|
rd_cnt <= (others => '0');
|
|
rd_en <= '0';
|
|
else
|
|
rd_cnt <= rd_cnt + 1;
|
|
end if;
|
|
end if;
|
|
end if;
|
|
end process;
|
|
|
|
-------------------------------------------
|
|
-- MAIN PROCESSING
|
-- MAIN PROCESSING
|
-------------------------------------------
|
-------------------------------------------
|
process(clk,rst)
|
process(clk,rst)
|
begin
|
begin
|
if rst = '1' then
|
if rst = '1' then
|
Line 126... |
Line 99... |
runlength_reg <= (others => '0');
|
runlength_reg <= (others => '0');
|
runlength <= (others => '0');
|
runlength <= (others => '0');
|
dovalid <= '0';
|
dovalid <= '0';
|
zero_cnt <= (others => '0');
|
zero_cnt <= (others => '0');
|
zrl_proc <= '0';
|
zrl_proc <= '0';
|
zrl_proc_d1 <= '0';
|
rd_en <= '0';
|
|
rd_cnt <= (others => '0');
|
elsif clk = '1' and clk'event then
|
elsif clk = '1' and clk'event then
|
dovalid_reg <= '0';
|
dovalid_reg <= '0';
|
runlength_reg <= (others => '0');
|
runlength_reg <= (others => '0');
|
wr_cnt_d1 <= wr_cnt;
|
wr_cnt_d1 <= wr_cnt;
|
runlength <= std_logic_vector(runlength_reg);
|
runlength <= std_logic_vector(runlength_reg);
|
dovalid <= dovalid_reg;
|
dovalid <= dovalid_reg;
|
divalid <= rd_en;
|
divalid <= rd_en;
|
zrl_proc_d1 <= zrl_proc;
|
|
|
if start_pb = '1' then
|
|
rd_cnt <= (others => '0');
|
|
rd_en <= '1';
|
|
end if;
|
|
|
|
-- input read enable
|
|
if rd_en = '1' then
|
|
if rd_cnt = 64-1 then
|
|
rd_cnt <= (others => '0');
|
|
rd_en <= '0';
|
|
else
|
|
rd_cnt <= rd_cnt + 1;
|
|
end if;
|
|
end if;
|
|
|
-- input data valid
|
-- input data valid
|
if divalid = '1' and zrl_proc_d1 = '0' then
|
if divalid = '1' then
|
wr_cnt <= wr_cnt + 1;
|
wr_cnt <= wr_cnt + 1;
|
|
|
-- first DCT coefficient received, DC data
|
-- first DCT coefficient received, DC data
|
if wr_cnt = 0 then
|
if wr_cnt = 0 then
|
-- differental coding of DC data per component
|
-- differental coding of DC data per component
|
Line 189... |
Line 177... |
zero_cnt <= zero_cnt - 16;
|
zero_cnt <= zero_cnt - 16;
|
dovalid_reg <= '1';
|
dovalid_reg <= '1';
|
-- stall input until ZRL is handled
|
-- stall input until ZRL is handled
|
zrl_proc <= '1';
|
zrl_proc <= '1';
|
zrl_di <= di;
|
zrl_di <= di;
|
|
divalid <= '0';
|
|
rd_cnt <= rd_cnt;
|
end if;
|
end if;
|
end if;
|
end if;
|
end if;
|
end if;
|
end if;
|
end if;
|
|
|
-- ZRL processing
|
-- ZRL processing
|
if zrl_proc = '1' then
|
if zrl_proc = '1' then
|
if zero_cnt <= 15 then
|
if zero_cnt <= 15 then
|
acc_reg <= RESIZE(SIGNED(zrl_di),RAMDATA_W+1);
|
acc_reg <= RESIZE(SIGNED(zrl_di),RAMDATA_W+1);
|
runlength_reg <= zero_cnt(3 downto 0);
|
runlength_reg <= zero_cnt(3 downto 0);
|
if signed(di) = 0 then
|
if signed(zrl_di) = 0 then
|
zero_cnt <= to_unsigned(1,zero_cnt'length);
|
zero_cnt <= to_unsigned(1,zero_cnt'length);
|
else
|
else
|
zero_cnt <= (others => '0');
|
zero_cnt <= (others => '0');
|
end if;
|
end if;
|
dovalid_reg <= '1';
|
dovalid_reg <= '1';
|
|
divalid <= '1';
|
-- continue input handling
|
-- continue input handling
|
zrl_proc <= '0';
|
zrl_proc <= '0';
|
-- zero_cnt > 15
|
-- zero_cnt > 15
|
else
|
else
|
-- generate ZRL
|
-- generate ZRL
|
acc_reg <= (others => '0');
|
acc_reg <= (others => '0');
|
runlength_reg <= X"F";
|
runlength_reg <= X"F";
|
zero_cnt <= zero_cnt - 16;
|
zero_cnt <= zero_cnt - 16;
|
dovalid_reg <= '1';
|
dovalid_reg <= '1';
|
|
divalid <= '0';
|
|
rd_cnt <= rd_cnt;
|
end if;
|
end if;
|
end if;
|
end if;
|
|
|
-- start of 8x8 block processing
|
-- start of 8x8 block processing
|
if start_pb = '1' then
|
if start_pb = '1' then
|