kopia lustrzana https://github.com/hoglet67/RGBtoHDMI
Atom CPLD: Discriminate normal and bright orange
Change-Id: Id9e1d6b2872f5a3bc863ad891c3418ba8b6228capull/12/head
rodzic
0af1234a65
commit
d9fbb6a033
|
@ -63,10 +63,10 @@ architecture Behavorial of RGBtoHDMI is
|
||||||
-- Sampling points
|
-- Sampling points
|
||||||
constant INIT_SAMPLING_POINTS : std_logic_vector(3 downto 0) := "0000";
|
constant INIT_SAMPLING_POINTS : std_logic_vector(3 downto 0) := "0000";
|
||||||
|
|
||||||
signal shift_R : std_logic_vector(1 downto 0);
|
signal shift_R : std_logic_vector(1 downto 0);
|
||||||
signal shift_G1 : std_logic_vector(1 downto 0);
|
signal shift_G : std_logic_vector(1 downto 0);
|
||||||
signal shift_G2 : std_logic_vector(1 downto 0);
|
signal shift_B : std_logic_vector(1 downto 0);
|
||||||
signal shift_B : std_logic_vector(1 downto 0);
|
signal shift_X : std_logic_vector(1 downto 0);
|
||||||
|
|
||||||
-- The sampling counter runs at 8x pixel clock of 7.15909MHz = 56.272720MHz
|
-- The sampling counter runs at 8x pixel clock of 7.15909MHz = 56.272720MHz
|
||||||
--
|
--
|
||||||
|
@ -92,38 +92,42 @@ architecture Behavorial of RGBtoHDMI is
|
||||||
|
|
||||||
-- Decoded RGB signals
|
-- Decoded RGB signals
|
||||||
signal R : std_logic;
|
signal R : std_logic;
|
||||||
signal G1 : std_logic;
|
signal G : std_logic;
|
||||||
signal G2 : std_logic;
|
|
||||||
signal B : std_logic;
|
signal B : std_logic;
|
||||||
|
signal X : std_logic; -- indicates either dark orange or bright orange
|
||||||
|
|
||||||
-- R/PA/PB processing pipeline
|
-- R/PA/PB processing pipeline
|
||||||
signal AL1: std_logic;
|
signal AL1 : std_logic;
|
||||||
signal AH1: std_logic;
|
signal AH1 : std_logic;
|
||||||
signal BL1: std_logic;
|
signal BL1 : std_logic;
|
||||||
signal BH1: std_logic;
|
signal BH1 : std_logic;
|
||||||
signal L1: std_logic;
|
signal LL1 : std_logic;
|
||||||
|
signal LH1 : std_logic;
|
||||||
|
|
||||||
signal AL2: std_logic;
|
signal AL2 : std_logic;
|
||||||
signal AH2: std_logic;
|
signal AH2 : std_logic;
|
||||||
signal BL2: std_logic;
|
signal BL2 : std_logic;
|
||||||
signal BH2: std_logic;
|
signal BH2 : std_logic;
|
||||||
signal L2: std_logic;
|
signal LL2 : std_logic;
|
||||||
|
signal LH2 : std_logic;
|
||||||
|
|
||||||
signal AL3: std_logic;
|
signal AL3 : std_logic;
|
||||||
signal AH3: std_logic;
|
signal AH3 : std_logic;
|
||||||
signal BL3: std_logic;
|
signal BL3 : std_logic;
|
||||||
signal BH3: std_logic;
|
signal BH3 : std_logic;
|
||||||
signal L3: std_logic;
|
signal LL3 : std_logic;
|
||||||
|
signal LH3 : std_logic;
|
||||||
|
|
||||||
signal AL: std_logic;
|
signal AL : std_logic;
|
||||||
signal AH: std_logic;
|
signal AH : std_logic;
|
||||||
signal BL: std_logic;
|
signal BL : std_logic;
|
||||||
signal BH: std_logic;
|
signal BH : std_logic;
|
||||||
signal L: std_logic;
|
signal LL : std_logic;
|
||||||
|
signal LH : std_logic;
|
||||||
|
|
||||||
signal HS1: std_logic;
|
signal HS1 : std_logic;
|
||||||
signal HS2: std_logic;
|
signal HS2 : std_logic;
|
||||||
signal FS1: std_logic;
|
signal FS1 : std_logic;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
|
||||||
|
@ -186,9 +190,13 @@ begin
|
||||||
BL3 <= BL2;
|
BL3 <= BL2;
|
||||||
BH3 <= BH2;
|
BH3 <= BH2;
|
||||||
|
|
||||||
L1 <= L_I;
|
LL1 <= L_I;
|
||||||
L2 <= L1;
|
LL2 <= LL1;
|
||||||
L3 <= L2;
|
LL3 <= LL2;
|
||||||
|
|
||||||
|
LH1 <= SYNC_I;
|
||||||
|
LH2 <= LH1;
|
||||||
|
LH3 <= LH2;
|
||||||
|
|
||||||
if sample_C = '1' then
|
if sample_C = '1' then
|
||||||
AL <= (AL1 AND AL2) OR (AL1 AND AL3) OR (AL2 AND AL3);
|
AL <= (AL1 AND AL2) OR (AL1 AND AL3) OR (AL2 AND AL3);
|
||||||
|
@ -198,54 +206,54 @@ begin
|
||||||
end if;
|
end if;
|
||||||
|
|
||||||
if sample_L = '1' then
|
if sample_L = '1' then
|
||||||
L <= (L1 AND L2) OR (L1 AND L3) OR (L2 AND L3);
|
LL <= (LL1 AND LL2) OR (LL1 AND LL3) OR (LL2 AND LL3);
|
||||||
|
LH <= (LH1 AND LH2) OR (LH1 AND LH3) OR (LH2 AND LH3);
|
||||||
end if;
|
end if;
|
||||||
|
|
||||||
-- YUV to RGB
|
-- YUV to RGB
|
||||||
if sample_L = '1' then
|
if sample_L = '1' then
|
||||||
-- AL AH BL BH L R G1 G2 B
|
-- AL AH BL BH LL LH X B G R
|
||||||
--YELLOW 1.5 1.0 0 0 1 0 X 1 1 1 0
|
--YELLOW WH 1.5 1.0 0 0 1 0 X X 0 0 1 1
|
||||||
--RED 2.0 1.5 0 1 0 0 X 1 0 1 0
|
--RED WL 2.0 1.5 0 1 0 0 X X 0 0 0 1
|
||||||
--MAGENTA 2.0 2.0 0 1 0 1 X 1 0 1 1
|
--MAGENTA WM 2.0 2.0 0 1 0 1 X X 0 1 0 1
|
||||||
--BUFF 1.5 1.5 0 0 0 0 1 1 1 1 1
|
--BUFF WH 1.5 1.5 0 0 0 0 1 X 0 1 1 1
|
||||||
--ORANGE 2.0 1.0 0 1 1 0 1 1 1 0 0
|
--BRIGHT ORANGE WL 2.0 1.0 0 1 1 0 X 1 1 0 0 1
|
||||||
|
|
||||||
R <= (NOT AL AND NOT AH AND BL AND NOT BH) OR (NOT AL AND AH AND NOT BL AND NOT BH) OR (NOT AL AND AH AND NOT BL AND BH) OR (NOT AL AND NOT AH AND NOT BL AND NOT BH AND L) OR (NOT AL AND AH AND BL AND NOT BH AND L);
|
R <= (NOT AL AND NOT AH AND BL AND NOT BH) OR (NOT AL AND AH AND NOT BL AND NOT BH) OR (NOT AL AND AH AND NOT BL AND BH) OR (NOT AL AND NOT AH AND NOT BL AND NOT BH AND LL) OR (NOT AL AND AH AND BL AND NOT BH AND LH);
|
||||||
|
|
||||||
-- AL AH BL BH L R G1 G2 B
|
-- AL AH BL BH LL LH X B G R
|
||||||
--YELLOW 1.5 1.0 0 0 1 0 X 1 1 1 0
|
--YELLOW WM 1.5 1.0 0 0 1 0 X X 0 0 1 1
|
||||||
--CYAN 1.0 1.5 1 0 0 0 X 0 1 1 1
|
--CYAN WM 1.0 1.5 1 0 0 0 X X 0 1 1 0
|
||||||
--GREEN 1.0 1.0 1 0 1 0 1 0 1 1 0
|
--GREEN WM 1.0 1.0 1 0 1 0 1 X 0 0 1 0
|
||||||
--BUFF 1.5 1.5 0 0 0 0 1 1 1 1 1
|
--BUFF WM 1.5 1.5 0 0 0 0 1 X 0 1 1 1
|
||||||
--ORANGE 2.0 1.0 0 1 1 0 1 1 1 0 0
|
|
||||||
|
|
||||||
G1 <= (NOT AL AND NOT AH AND BL AND NOT BH) OR (AL AND NOT AH AND NOT BL AND NOT BH) OR (AL AND NOT AH AND BL AND NOT BH AND L) OR (NOT AL AND NOT AH AND NOT BL AND NOT BH AND L) OR (NOT AL AND AH AND BL AND NOT BH AND L);
|
G <= (NOT AL AND NOT AH AND BL AND NOT BH) OR (AL AND NOT AH AND NOT BL AND NOT BH) OR (AL AND NOT AH AND BL AND NOT BH AND LL) OR (NOT AL AND NOT AH AND NOT BL AND NOT BH AND LL);
|
||||||
|
|
||||||
-- AL AH BL BH L R G1 G2 B
|
-- AL AH BL BH LL LH X B G R
|
||||||
--ORANGE 2.0 1.0 0 1 1 0 1 1 1 0 0
|
--BLUE WL 1.5 2.0 0 0 0 1 X X 0 1 0 0
|
||||||
|
--CYAN WM 1.0 1.5 1 0 0 0 X X 0 1 1 0
|
||||||
|
--MAGENTA WM 2.0 2.0 0 1 0 1 X X 0 1 0 1
|
||||||
|
--BUFF WM 1.5 1.5 0 0 0 0 1 X 0 1 1 1
|
||||||
|
|
||||||
-- Note: invert this, so orange appears in colours 8..15
|
B <= (NOT AL AND NOT AH AND NOT BL AND BH) OR (AL AND NOT AH AND NOT BL AND NOT BH) OR (NOT AL AND AH AND NOT BL AND BH) OR (NOT AL AND NOT AH AND NOT BL AND NOT BH AND LL);
|
||||||
G2 <= (NOT AL AND AH AND BL AND NOT BH AND L);
|
|
||||||
|
|
||||||
-- AL AH BL BH L R G1 G2 B
|
-- AL AH BL BH LL LH X B G R
|
||||||
--BLUE 1.5 2.0 0 0 0 1 X 0 0 1 1
|
--DARK ORANGE WM 2.0 1.0 0 1 1 0 1 0 1 0 0 0
|
||||||
--CYAN 1.0 1.5 1 0 0 0 X 0 1 1 1
|
--BRIGHT ORANGE WM 2.0 1.0 0 1 1 0 1 1 1 0 0 1
|
||||||
--MAGENTA 2.0 2.0 0 1 0 1 X 1 0 1 1
|
|
||||||
--BUFF 1.5 1.5 0 0 0 0 1 1 1 1 1
|
|
||||||
|
|
||||||
B <= (NOT AL AND NOT AH AND NOT BL AND BH) OR (AL AND NOT AH AND NOT BL AND NOT BH) OR (NOT AL AND AH AND NOT BL AND BH) OR (NOT AL AND NOT AH AND NOT BL AND NOT BH AND L);
|
X <= (NOT AL AND AH AND BL AND NOT BH AND LL);
|
||||||
|
|
||||||
end if;
|
end if;
|
||||||
|
|
||||||
if sample_L = '1' and counter(counter'left) = '0' then
|
if sample_L = '1' and counter(counter'left) = '0' then
|
||||||
-- R Sample/shift register
|
-- R Sample/shift register
|
||||||
shift_R <= R & shift_R(1);
|
shift_R <= R & shift_R(1);
|
||||||
-- G1 Sample/shift register
|
-- G Sample/shift register
|
||||||
shift_G1 <= G1 & shift_G1(1);
|
shift_G <= G & shift_G(1);
|
||||||
-- G2 Sample/shift register
|
|
||||||
shift_G2 <= G2 & shift_G2(1);
|
|
||||||
-- B Sample/shift register
|
-- B Sample/shift register
|
||||||
shift_B <= B & shift_B(1);
|
shift_B <= B & shift_B(1);
|
||||||
|
-- X Sample/shift register
|
||||||
|
shift_X <= X & shift_X(1);
|
||||||
end if;
|
end if;
|
||||||
|
|
||||||
-- Output quad register
|
-- Output quad register
|
||||||
|
@ -258,13 +266,13 @@ begin
|
||||||
quad(10) <= '0';
|
quad(10) <= '0';
|
||||||
quad(9) <= '0';
|
quad(9) <= '0';
|
||||||
quad(8) <= '0';
|
quad(8) <= '0';
|
||||||
quad(7) <= shift_G2(1);
|
quad(7) <= shift_X(1);
|
||||||
quad(6) <= shift_B(1);
|
quad(6) <= shift_B(1);
|
||||||
quad(5) <= shift_G1(1);
|
quad(5) <= shift_G(1);
|
||||||
quad(4) <= shift_R(1);
|
quad(4) <= shift_R(1);
|
||||||
quad(3) <= shift_G2(0);
|
quad(3) <= shift_X(0);
|
||||||
quad(2) <= shift_B(0);
|
quad(2) <= shift_B(0);
|
||||||
quad(1) <= shift_G1(0);
|
quad(1) <= shift_G(0);
|
||||||
quad(0) <= shift_R(0);
|
quad(0) <= shift_R(0);
|
||||||
psync <= counter(4);
|
psync <= counter(4);
|
||||||
end if;
|
end if;
|
||||||
|
|
|
@ -85,3 +85,14 @@ FB3 18/18* 28/54 63/90 8/ 9
|
||||||
FB4 18/18* 27/54 36/90 7/ 7*
|
FB4 18/18* 27/54 36/90 7/ 7*
|
||||||
----- ----- ----- -----
|
----- ----- ----- -----
|
||||||
65/72 102/216 166/360 27/34
|
65/72 102/216 166/360 27/34
|
||||||
|
|
||||||
|
9. Atom CPLD: Discriminate dark and bright orange
|
||||||
|
|
||||||
|
Function Mcells FB Inps Pterms IO
|
||||||
|
Block Used/Tot Used/Tot Used/Tot Used/Tot
|
||||||
|
FB1 18/18* 28/54 46/90 8/ 9
|
||||||
|
FB2 15/18 24/54 25/90 5/ 9
|
||||||
|
FB3 18/18* 28/54 63/90 8/ 9
|
||||||
|
FB4 18/18* 29/54 39/90 7/ 7*
|
||||||
|
----- ----- ----- -----
|
||||||
|
69/72 109/216 173/360 28/34
|
||||||
|
|
Ładowanie…
Reference in New Issue