File: ../../Sources/A14_run_length_determination.vhd
0: ----------------------------------------------------------------------------------
1: -- Engineer: Vitor Mendes Camilo
2: --
3: -- Module Name: A14_run_length_determination - Behavioral
4: -- Description: Code segment A.14 — run-length determination (lossless only).
5: -- With NEAR=0, the T.87 condition |Ix - RUNval| <= NEAR
6: -- reduces to Ix == RUNval (RUNval = Ra).
7: -- In lossless mode, Rx = Ix always, so oRx is not produced.
8: ----------------------------------------------------------------------------------
9:
10: library ieee;
11: use ieee.std_logic_1164.all;
12: use ieee.numeric_std.all;
13: use work.openjls_pkg.all;
14:
15: entity a14_run_length_determination is
16: generic (
17: BITNESS : natural range 8 to 16 := CO_BITNESS_STD;
18: RUN_CNT_WIDTH : natural := 16
19: );
20: port (
21: iRa : in unsigned (BITNESS - 1 downto 0);
22: iIx : in unsigned (BITNESS - 1 downto 0);
23: iRunCnt : in unsigned (RUN_CNT_WIDTH - 1 downto 0);
24: iEol : in std_logic;
25: oRunCnt : out unsigned (RUN_CNT_WIDTH - 1 downto 0);
26: oRunHit : out std_logic;
27: oRunContinue : out std_logic
28: );
29: end entity a14_run_length_determination;
30:
31: architecture behavioral of a14_run_length_determination is
32:
33: signal sRunHit : std_logic;
34:
35: begin
36:
37: sRunHit <= '1' when iIx = iRa else
38: '0';
39: oRunCnt <= iRunCnt + 1 when sRunHit = '1' else
40: iRunCnt;
41: oRunHit <= sRunHit;
42: oRunContinue <= sRunHit and not iEol;
43:
44: end architecture behavioral;