OpenCores
URL https://opencores.org/ocsvn/matrix3x3/matrix3x3/trunk

Subversion Repositories matrix3x3

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /matrix3x3/tags/arelease/rtl
    from Rev 3 to Rev 8
    Reverse comparison

Rev 3 → Rev 8

/vhdl/colorconv.vhd
0,0 → 1,191
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;
 
use work.ccfactors_pkg.all;
 
entity colorconv is
generic(DATA_WIDTH : INTEGER);
port (
clk : IN STD_LOGIC;
rstn : IN STD_LOGIC;
 
DATA_ENA : IN STD_LOGIC;
DOUT_RDY : OUT STD_LOGIC;
 
-- input vector
x1 : IN UNSIGNED( data_width-1 downto 0 );
x2 : IN UNSIGNED( data_width-1 downto 0 );
x3 : IN UNSIGNED( data_width-1 downto 0 );
 
-- matrix factors
a11,a12,a13 : IN SIGNED( FACTORS_WIDTH-1 downto 0 );
a21,a22,a23 : IN SIGNED( FACTORS_WIDTH-1 downto 0 );
a31,a32,a33 : IN SIGNED( FACTORS_WIDTH-1 downto 0 );
 
--shift vectors
b1x,b2x,b3x : IN SIGNED( FACTORS_WIDTH-1 downto 0 );
b1y,b2y,b3y : IN SIGNED( FACTORS_WIDTH-1 downto 0 );
 
-- output vector
y1c : OUT SIGNED( int_factors_part-1 downto 0 );
y2c : OUT SIGNED( int_factors_part-1 downto 0 );
y3c : OUT SIGNED( int_factors_part-1 downto 0 );
y1 : OUT UNSIGNED( data_width-1 downto 0 );
y2 : OUT UNSIGNED( data_width-1 downto 0 );
y3 : OUT UNSIGNED( data_width-1 downto 0 )
);
end colorconv;
 
architecture a of colorconv is
 
-- the result full width will be
signal m11, m12, m13 : SIGNED( (data_width+factors_width) downto 0 );
signal m21, m22, m23 : SIGNED( (data_width+factors_width) downto 0 );
signal m31, m32, m33 : SIGNED( (data_width+factors_width) downto 0 );
 
signal x1sh, x2sh, x3sh : SIGNED( data_width downto 0 );
 
signal x1s, x2s, x3s : SIGNED( data_width downto 0 );
 
signal y1s, y2s, y3s : SIGNED( data_width+int_factors_part-1 downto 0 );
 
signal y1sh, y2sh, y3sh : SIGNED( data_width+int_factors_part-1 downto 0 );
 
signal y1r, y2r, y3r : SIGNED( data_width+int_factors_part-1 downto 0 );
 
signal y1ro, y2ro, y3ro : SIGNED( data_width+int_factors_part-1 downto 0 );
 
signal s1w, s2w, s3w : SIGNED( (data_width+factors_width) downto 0 );
 
signal d1, d2, d3 : SIGNED( (data_width+factors_width) downto 0 );
 
signal y1w,y2w,y3w : SIGNED( (data_width+factors_width) downto 0 );
 
signal pipe_delay : STD_LOGIC_VECTOR( 10 downto 0 );
 
begin
 
x1s <= '0' & Signed(x1);
x2s <= '0' & Signed(x2);
x3s <= '0' & Signed(x3);
 
process(clk, rstn)
begin
if rstn = '0' then
 
m11 <= (others=>'0');
m12 <= (others=>'0');
m13 <= (others=>'0');
m21 <= (others=>'0');
m22 <= (others=>'0');
m23 <= (others=>'0');
m31 <= (others=>'0');
m32 <= (others=>'0');
m33 <= (others=>'0');
 
s1w <= (others=>'0');
s2w <= (others=>'0');
s3w <= (others=>'0');
 
d1 <= (others=>'0');
d2 <= (others=>'0');
d3 <= (others=>'0');
 
y1w <= (others=>'0');
y2w <= (others=>'0');
y3w <= (others=>'0');
 
y1sh <= (others=>'0');
y2sh <= (others=>'0');
y3sh <= (others=>'0');
 
y1ro <= (others=>'0');
y2ro <= (others=>'0');
y3ro <= (others=>'0');
 
elsif rising_edge(clk) then
 
x1sh <= x1s+b1x(FACTORS_WIDTH-1 DOWNTO FACTORS_WIDTH-DATA_WIDTH-1);
x2sh <= x2s+b2x(FACTORS_WIDTH-1 DOWNTO FACTORS_WIDTH-DATA_WIDTH-1);
x3sh <= x3s+b3x(FACTORS_WIDTH-1 DOWNTO FACTORS_WIDTH-DATA_WIDTH-1);
 
m11 <= a11 * x1sh;
m12 <= a12 * x2sh;
m13 <= a13 * x3sh;
m21 <= a21 * x1sh;
m22 <= a22 * x2sh;
m23 <= a23 * x3sh;
m31 <= a31 * x1sh;
m32 <= a32 * x2sh;
m33 <= a33 * x3sh;
 
s1w <= m11 + m12;
s2w <= m21 + m22;
s3w <= m31 + m32;
 
d1 <= m13;
d2 <= m23;
d3 <= m33;
 
y1w <= s1w + d1;
y2w <= s2w + d2;
y3w <= s3w + d3;
y1s(data_width+int_factors_part-1 downto data_width) <= y1w(data_width+int_factors_part+f_factors_part-1 downto data_width+f_factors_part);
y2s(data_width+int_factors_part-1 downto data_width) <= y2w(data_width+int_factors_part+f_factors_part-1 downto data_width+f_factors_part);
y3s(data_width+int_factors_part-1 downto data_width) <= y3w(data_width+int_factors_part+f_factors_part-1 downto data_width+f_factors_part);
 
y1s(data_width-1 downto 0) <= y1w(data_width+f_factors_part-1 downto f_factors_part);
y2s(data_width-1 downto 0) <= y2w(data_width+f_factors_part-1 downto f_factors_part);
y3s(data_width-1 downto 0) <= y3w(data_width+f_factors_part-1 downto f_factors_part);
 
y1sh <= y1s + b1y(FACTORS_WIDTH-1 DOWNTO FACTORS_WIDTH-DATA_WIDTH-1);
y2sh <= y2s + b2y(FACTORS_WIDTH-1 DOWNTO FACTORS_WIDTH-DATA_WIDTH-1);
y3sh <= y3s + b3y(FACTORS_WIDTH-1 DOWNTO FACTORS_WIDTH-DATA_WIDTH-1);
y1r <= y1sh+y1w(f_factors_part-1);
y2r <= y2sh+y2w(f_factors_part-1);
y3r <= y3sh+y3w(f_factors_part-1);
 
if (y1r(data_width+int_factors_part-1)='1' and y1r(data_width)='1')then y1ro(data_width-1 downto 0)<=(others=>'0');
elsif (y1r(data_width+int_factors_part-1)='0' and y1r(data_width)='1')then y1ro(data_width-1 downto 0)<=(others=>'1');
else y1ro<=y1r;
end if;
 
if (y2r(data_width+int_factors_part-1)='1' and y2r(data_width)='1')then y2ro(data_width-1 downto 0)<=(others=>'0');
elsif (y2r(data_width+int_factors_part-1)='0' and y2r(data_width)='1')then y2ro(data_width-1 downto 0)<=(others=>'1');
else y2ro<=y2r;
end if;
 
if (y3r(data_width+int_factors_part-1)='1' and y3r(data_width)='1')then y3ro(data_width-1 downto 0)<=(others=>'0');
elsif (y3r(data_width+int_factors_part-1)='0' and y3r(data_width)='1')then y3ro(data_width-1 downto 0)<=(others=>'1');
else y3ro<=y3r;
end if;
 
end if;
end process;
 
y1c <= y1r(data_width+int_factors_part-1 downto data_width);
y2c <= y2r(data_width+int_factors_part-1 downto data_width);
y3c <= y3r(data_width+int_factors_part-1 downto data_width);
 
y1 <= UNSIGNED(y1ro(data_width-1 downto 0));
y2 <= UNSIGNED(y2ro(data_width-1 downto 0));
y3 <= UNSIGNED(y3ro(data_width-1 downto 0));
 
-- this shift register is nessecary for generating RDY sig and easy integration with fifo
process(clk, rstn)
begin
if rstn = '0' then
pipe_delay <= (others=>'0');
elsif rising_edge(clk) then
pipe_delay(0) <= DATA_ENA;
pipe_delay(8 downto 1) <= pipe_delay(7 downto 0);
end if;
end process;
 
DOUT_RDY <= pipe_delay(8);
 
 
end a;
/vhdl/ccfactors_pkg.vhd
0,0 → 1,318
-----------------------------------------------------------------------------------
--
-- There is package with factors for different color convertions.
-- Is used with mult3x3 matrix multiplier.
--
-- Source: "Digital Video and HDTV. Algorithms and Interfaces" Charles Poynton; ISBN 1-55860-792-7.
--
-- rev 1.0, 06.30.2006 : Michael Tsvetkov (csimplemapi@mail.ru)
--
-----------------------------------------------------------------------------------
 
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
 
package ccfactors_pkg is
 
TYPE COLOR_CONVERTION IS (
ComputerRGB_to_YCbCr601,
YCbCr601_to_ComputerRGB,
StudioRGB_to_YCbCr601,
YCbCr601_to_StudioRGB,
ComputerRGB_to_YCbCr709,
YCbCr709_to_ComputerRGB,
StudioRGB_to_YCbCr709,
YCbCr709_to_StudioRGB,
YCbCr709_to_YCbCr601,
YCbCr601_to_YCbCr709,
YUV601_to_YIQ601,
StudioRGB_to_YIQ601,
YIQ601_to_StudioRGB
);
CONSTANT F_FACTORS_PART : INTEGER := 15; -- float part width, 10-E4 accuracy
CONSTANT INT_FACTORS_PART: INTEGER := 3; -- integer part with, from -5 to +4 range (-4.999999 to 3.999999)
 
CONSTANT FACTORS_WIDTH : integer := (f_factors_part + int_factors_part); -- full factor width
 
-----------------------------------------------------------------------------------
-- Matrix factors for the Computer RGB to Rec.601 (SD) YCbCr color convertion
-----------------------------------------------------------------------------------
constant crgb2ycbcr601_a11 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000010000011011111"; -- 0.256789
constant crgb2ycbcr601_a12 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000100000010000110"; -- 0.504129
constant crgb2ycbcr601_a13 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000110010001000"; -- 0.0979
constant crgb2ycbcr601_a21 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"111110110100000111"; -- -0.148223
constant crgb2ycbcr601_a22 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"111101101011000001"; -- -0.290992
constant crgb2ycbcr601_a23 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000011100000111000"; -- 0.439215
constant crgb2ycbcr601_a31 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000011100000111000"; -- 0.439215
constant crgb2ycbcr601_a32 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"111101000011101100"; -- -0.367789
constant crgb2ycbcr601_a33 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"111111011011011100"; -- -0.071426
 
constant crgb2ycbcr601_b1x : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
constant crgb2ycbcr601_b2x : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
constant crgb2ycbcr601_b3x : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
 
constant crgb2ycbcr601_b1y : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000010000000000000"; -- 16
constant crgb2ycbcr601_b2y : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"010000000000000000"; -- 128
constant crgb2ycbcr601_b3y : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"010000000000000000"; -- 128
 
-----------------------------------------------------------------------------------
-- Matrix factors for the Rec.601 YCbCr to Computer RGB color convertion
-----------------------------------------------------------------------------------
constant ycbcr601_crgb_a11 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"001001010100001011"; -- 1.16438
constant ycbcr601_crgb_a12 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
constant ycbcr601_crgb_a13 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"001100110001001010"; -- 1.59603
constant ycbcr601_crgb_a21 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"001001010100001011"; -- 1.16438
constant ycbcr601_crgb_a22 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"111100110111011010"; -- -0.391762
constant ycbcr601_crgb_a23 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"111001011111110000"; -- -0.812969
constant ycbcr601_crgb_a31 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"001001010100001011"; -- 1.16438
constant ycbcr601_crgb_a32 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"010000001000110100"; -- 2.01723
constant ycbcr601_crgb_a33 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
 
constant ycbcr601_crgb_b1x : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"111110000000000000"; -- -16
constant ycbcr601_crgb_b2x : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"110000000000000000"; -- -128
constant ycbcr601_crgb_b3x : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"110000000000000000"; -- -128
 
constant ycbcr601_crgb_b1y : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
constant ycbcr601_crgb_b2y : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
constant ycbcr601_crgb_b3y : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
 
-----------------------------------------------------------------------------------
-- Matrix factors for the Studio RGB to Rec.601 (SD) YCbCr color convertion
-----------------------------------------------------------------------------------
constant srgb2ycbcr601_a11 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000010011001000110"; -- 0.299000
constant srgb2ycbcr601_a12 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000100101100100011"; -- 0.587000
constant srgb2ycbcr601_a13 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000111010011000"; -- 0.114000
constant srgb2ycbcr601_a21 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"111110100111101001"; -- -0.172586
constant srgb2ycbcr601_a22 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"111101010010100001"; -- -0.338828
constant srgb2ycbcr601_a23 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000100000101110110"; -- 0.511414
constant srgb2ycbcr601_a31 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000100000101110110"; -- 0.511414
constant srgb2ycbcr601_a32 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"111100100100101111"; -- -0.428246
constant srgb2ycbcr601_a33 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"111111010101011011"; -- -0.083168
 
constant srgb2ycbcr601_b1x : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
constant srgb2ycbcr601_b2x : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
constant srgb2ycbcr601_b3x : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
 
constant srgb2ycbcr601_b1y : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000010000000000000"; -- 16
constant srgb2ycbcr601_b2y : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"010000000000000000"; -- 128
constant srgb2ycbcr601_b3y : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"010000000000000000"; -- 128
 
-----------------------------------------------------------------------------------
-- Matrix factors for the Rec.601 YCbCr to Studio RGB color convertion
-----------------------------------------------------------------------------------
constant ycbcr601_srgb_a11 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"001000000000000000"; -- 1
constant ycbcr601_srgb_a12 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
constant ycbcr601_srgb_a13 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"001010111101110011"; -- 1.37071
constant ycbcr601_srgb_a21 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"001000000000000000"; -- 1
constant ycbcr601_srgb_a22 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"111101010011101111"; -- -0.336453
constant ycbcr601_srgb_a23 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"111010011010100010"; -- -0.698195
constant ycbcr601_srgb_a31 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"001000000000000000"; -- 1
constant ycbcr601_srgb_a32 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"001101110111000001"; -- 1.73245
constant ycbcr601_srgb_a33 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
 
constant ycbcr601_srgb_b1x : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"111110000000000000"; -- -16
constant ycbcr601_srgb_b2x : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"110000000000000000"; -- -128
constant ycbcr601_srgb_b3x : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"110000000000000000"; -- -128
 
constant ycbcr601_srgb_b1y : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
constant ycbcr601_srgb_b2y : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
constant ycbcr601_srgb_b3y : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
 
-----------------------------------------------------------------------------------
-- Matrix factors for the Computer RGB to Rec.709 (HD) YCbCr color convertion
-----------------------------------------------------------------------------------
constant crgb2ycbcr709_a11 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000001011101011111"; -- 0.182586
constant crgb2ycbcr709_a12 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000100111010011111"; -- 0.614230
constant crgb2ycbcr709_a13 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000011111110000"; -- 0.062008
constant crgb2ycbcr709_a21 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"111111001100011110"; -- -0.100645
constant crgb2ycbcr709_a22 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"111101010010101010"; -- -0.338570
constant crgb2ycbcr709_a23 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000011100000111000"; -- 0.439215
constant crgb2ycbcr709_a31 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000011100000111000"; -- 0.439215
constant crgb2ycbcr709_a32 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"111100110011110000"; -- -0.398941
constant crgb2ycbcr709_a33 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"111111101011011000"; -- -0.040273
 
constant crgb2ycbcr709_b1x : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
constant crgb2ycbcr709_b2x : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
constant crgb2ycbcr709_b3x : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
 
constant crgb2ycbcr709_b1y : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000010000000000000"; -- 16
constant crgb2ycbcr709_b2y : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"010000000000000000"; -- 128
constant crgb2ycbcr709_b3y : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"010000000000000000"; -- 128
 
-----------------------------------------------------------------------------------
-- Matrix factors for the Rec.709 YCbCr to Computer RGB color convertion
-----------------------------------------------------------------------------------
constant ycbcr709_crgb_a11 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"001001010100001010"; -- 1.16438
constant ycbcr709_crgb_a12 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
constant ycbcr709_crgb_a13 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"001110010101111001"; -- 1.79274
constant ycbcr709_crgb_a21 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"001001010100001010"; -- 1.16438
constant ycbcr709_crgb_a22 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"111110010010110011"; -- -0.213250
constant ycbcr709_crgb_a23 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"111011101111001010"; -- -0.532910
constant ycbcr709_crgb_a31 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"001001010100001010"; -- 1.16438
constant ycbcr709_crgb_a32 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"010000111001100011"; -- 2.11240
constant ycbcr709_crgb_a33 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
 
constant ycbcr709_crgb_b1x : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"111110000000000000"; -- -16
constant ycbcr709_crgb_b2x : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"110000000000000000"; -- -128
constant ycbcr709_crgb_b3x : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"110000000000000000"; -- -128
 
constant ycbcr709_crgb_b1y : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
constant ycbcr709_crgb_b2y : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
constant ycbcr709_crgb_b3y : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
 
-----------------------------------------------------------------------------------
-- Matrix factors for the Studio RGB to Rec.709 (HD) YCbCr color convertion
-----------------------------------------------------------------------------------
constant srgb2ycbcr709_a11 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000001101100110111"; -- 0.212602
constant srgb2ycbcr709_a12 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000101101110001100"; -- 0.715199
constant srgb2ycbcr709_a13 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000100100111110"; -- 0.072199
constant srgb2ycbcr709_a21 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"111111000100000000"; -- -0.117188
constant srgb2ycbcr709_a22 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"111100110110001010"; -- -0.394227
constant srgb2ycbcr709_a23 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000100000101110110"; -- 0.511414
constant srgb2ycbcr709_a31 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000100000101110110"; -- 0.511414
constant srgb2ycbcr709_a32 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"111100010010001011"; -- -0.464523
constant srgb2ycbcr709_a33 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"111111100111111111"; -- -0.046895
 
constant srgb2ycbcr709_b1x : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
constant srgb2ycbcr709_b2x : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
constant srgb2ycbcr709_b3x : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
 
constant srgb2ycbcr709_b1y : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000010000000000000"; -- 16
constant srgb2ycbcr709_b2y : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"010000000000000000"; -- 128
constant srgb2ycbcr709_b3y : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"010000000000000000"; -- 128
 
-----------------------------------------------------------------------------------
-- Matrix factors for the Rec.709 YCbCr to Studio RGB color convertion
-----------------------------------------------------------------------------------
constant ycbcr709_srgb_a11 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"001000000000000000"; -- 1
constant ycbcr709_srgb_a12 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
constant ycbcr709_srgb_a13 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"001100010100010011"; -- 1.53965
constant ycbcr709_srgb_a21 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"001000000000000000"; -- 1
constant ycbcr709_srgb_a22 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"111110100010001111"; -- -0.183145
constant ycbcr709_srgb_a23 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"111100010101101011"; -- -0.457676
constant ycbcr709_srgb_a31 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"001000000000000000"; -- 1
constant ycbcr709_srgb_a32 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"001110100000110111"; -- 1.81418
constant ycbcr709_srgb_a33 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
 
constant ycbcr709_srgb_b1x : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"111110000000000000"; -- -16
constant ycbcr709_srgb_b2x : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"110000000000000000"; -- -128
constant ycbcr709_srgb_b3x : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"110000000000000000"; -- -128
 
constant ycbcr709_srgb_b1y : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
constant ycbcr709_srgb_b2y : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
constant ycbcr709_srgb_b3y : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
 
-----------------------------------------------------------------------------------
-- Matrix factors for the Rec.709 YCbCr to Rec.601 YCbCr color convertion
-----------------------------------------------------------------------------------
constant ycbcr709_ycbcr601_a11 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"001000000000000000"; -- 1
constant ycbcr709_ycbcr601_a12 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000110010110110"; -- 0.099312
constant ycbcr709_ycbcr601_a13 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000001100010001010"; -- 0.1917
constant ycbcr709_ycbcr601_a21 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
constant ycbcr709_ycbcr601_a22 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000111111010110100"; -- 0.989854
constant ycbcr709_ycbcr601_a23 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"111111000111010110"; -- -0.110653
constant ycbcr709_ycbcr601_a31 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
constant ycbcr709_ycbcr601_a32 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"111111011010111010"; -- -0.072453
constant ycbcr709_ycbcr601_a33 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000111110111100000"; -- 0.983398
 
constant ycbcr709_ycbcr601_b1x : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
constant ycbcr709_ycbcr601_b2x : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
constant ycbcr709_ycbcr601_b3x : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
 
constant ycbcr709_ycbcr601_b1y : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
constant ycbcr709_ycbcr601_b2y : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
constant ycbcr709_ycbcr601_b3y : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
 
-----------------------------------------------------------------------------------
-- Matrix factors for the Rec.601 YCbCr to Rec.709 YCbCr color convertion
-----------------------------------------------------------------------------------
constant ycbcr601_ycbcr709_a11 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"001000000000000000"; -- 1
constant ycbcr601_ycbcr709_a12 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"111111000100110110"; -- -0.11555
constant ycbcr601_ycbcr709_a13 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"111110010101100010"; -- -0.207938
constant ycbcr601_ycbcr709_a21 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
constant ycbcr601_ycbcr709_a22 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"001000001001100011"; -- 1.01864
constant ycbcr601_ycbcr709_a23 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000111010101100"; -- 0.114618
constant ycbcr601_ycbcr709_a31 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
constant ycbcr601_ycbcr709_a32 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000100110011011"; -- 0.075049
constant ycbcr601_ycbcr709_a33 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"001000001100111110"; -- 1.025327
 
constant ycbcr601_ycbcr709_b1x : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
constant ycbcr601_ycbcr709_b2x : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
constant ycbcr601_ycbcr709_b3x : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
 
constant ycbcr601_ycbcr709_b1y : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
constant ycbcr601_ycbcr709_b2y : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
constant ycbcr601_ycbcr709_b3y : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
 
-----------------------------------------------------------------------------------
-- Matrix factors for the Rec.601 YUV to Rec.601 YIQ color convertion
-----------------------------------------------------------------------------------
constant yuv601_yiq601_a11 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"001000000000000000"; -- 1
constant yuv601_yiq601_a12 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
constant yuv601_yiq601_a13 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
constant yuv601_yiq601_a21 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
constant yuv601_yiq601_a22 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"111011101001001001"; -- -0.544639
constant yuv601_yiq601_a23 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000110101101011010"; -- 0.838671
constant yuv601_yiq601_a31 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
constant yuv601_yiq601_a32 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000110101101011010"; -- 0.838671
constant yuv601_yiq601_a33 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000100010110110111"; -- 0.544639
 
constant yuv601_yiq601_b1x : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
constant yuv601_yiq601_b2x : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
constant yuv601_yiq601_b3x : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
 
constant yuv601_yiq601_b1y : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
constant yuv601_yiq601_b2y : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
constant yuv601_yiq601_b3y : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
 
-----------------------------------------------------------------------------------
-- Matrix factors for the Studio RGB to Rec.601 YIQ color convertion
-----------------------------------------------------------------------------------
constant srgb2yiq601_a11 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000010011001000110"; -- 0.299
constant srgb2yiq601_a12 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000100101100100011"; -- 0.587
constant srgb2yiq601_a13 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000111010011000"; -- 0.114
constant srgb2yiq601_a21 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000100110001000111"; -- 0.595901
constant srgb2yiq601_a22 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"111101110011011011"; -- -0.274557
constant srgb2yiq601_a23 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"111101011011011110"; -- -0.321344
constant srgb2yiq601_a31 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000001101100010100"; -- 0.211537
constant srgb2yiq601_a32 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"111011110100010111"; -- -0.522736
constant srgb2yiq601_a33 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000010011111010101"; -- 0.3112
 
constant srgb2yiq601_b1x : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
constant srgb2yiq601_b2x : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
constant srgb2yiq601_b3x : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
 
constant srgb2yiq601_b1y : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
constant srgb2yiq601_b2y : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
constant srgb2yiq601_b3y : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
 
-----------------------------------------------------------------------------------
-- Matrix factors for the Rec.601 YIQ to Studio RGB convertion
-----------------------------------------------------------------------------------
constant yiq601_srgb_a11 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"001000000000000000"; -- 1
constant yiq601_srgb_a12 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000111101001011110"; -- 0.955986
constant yiq601_srgb_a13 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000100111101110111"; -- 0.620825
constant yiq601_srgb_a21 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"001000000000000000"; -- 1
constant yiq601_srgb_a22 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"111101110100101111"; -- -0.272013
constant yiq601_srgb_a23 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"111010110100101000"; -- -0.647204
constant yiq601_srgb_a31 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"001000000000000000"; -- 1
constant yiq601_srgb_a32 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"110111001001010110"; -- -1.106740
constant yiq601_srgb_a33 : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"001101101000100100"; -- 1.704230
 
constant yiq601_srgb_b1x : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
constant yiq601_srgb_b2x : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
constant yiq601_srgb_b3x : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
 
constant yiq601_srgb_b1y : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
constant yiq601_srgb_b2y : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
constant yiq601_srgb_b3y : SIGNED(FACTORS_WIDTH-1 DOWNTO 0) := b"000000000000000000"; -- 0
 
end ccfactors_pkg;
 
 
---------------------------------------------------------------
---------------------------------------------------------------
 
package body ccfactors_pkg is
end ccfactors_pkg;
/vhdl/colorconv_wb.vhd
0,0 → 1,214
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;
 
use work.ccfactors_pkg.all;
 
entity colorconv_wb is
generic( DATA_WIDTH : INTEGER:=16);
port (
-- Data Bus (piped stream, our own bus) - x input and y output
x_clk : IN STD_LOGIC;
x_rstn : IN STD_LOGIC;
 
x_we_i : IN STD_LOGIC;
y_rdy_o : OUT STD_LOGIC;
 
-- input vector
x1_i : IN UNSIGNED( data_width-1 downto 0 );
x2_i : IN UNSIGNED( data_width-1 downto 0 );
x3_i : IN UNSIGNED( data_width-1 downto 0 );
-- output vector
y1c_o : OUT SIGNED( int_factors_part-1 downto 0 );
y2c_o : OUT SIGNED( int_factors_part-1 downto 0 );
y3c_o : OUT SIGNED( int_factors_part-1 downto 0 );
 
y1_o : OUT UNSIGNED( data_width-1 downto 0 );
y2_o : OUT UNSIGNED( data_width-1 downto 0 );
y3_o : OUT UNSIGNED( data_width-1 downto 0 );
 
-- Control Bus (WishBone Bus slave) - set factors and shifts regs for mult3x3
wb_clk_i : IN STD_LOGIC;
wb_rst_i : IN STD_LOGIC;
wb_stb_i : IN STD_LOGIC;
wb_we_i : IN STD_LOGIC;
-- data bus
wb_adr_i : IN STD_LOGIC_VECTOR (3 downto 0);
wb_dat_i : IN STD_LOGIC_VECTOR (f_factors_part+int_factors_part-1 downto 0);
wb_dat_o : OUT STD_LOGIC_VECTOR (f_factors_part+int_factors_part-1 downto 0)
);
end colorconv_wb;
 
architecture a of colorconv_wb is
 
constant factors_width : integer := (f_factors_part + int_factors_part); -- one sign bit
--factors for rgb2ycbcr conversion
SIGNAL a11 : signed(factors_width-1 downto 0);
SIGNAL a12 : signed(factors_width-1 downto 0);
SIGNAL a13 : signed(factors_width-1 downto 0);
SIGNAL a21 : signed(factors_width-1 downto 0);
SIGNAL a22 : signed(factors_width-1 downto 0);
SIGNAL a23 : signed(factors_width-1 downto 0);
SIGNAL a31 : signed(factors_width-1 downto 0);
SIGNAL a32 : signed(factors_width-1 downto 0);
SIGNAL a33 : signed(factors_width-1 downto 0);
 
--shift vectors for rgb2ycbcr conversion
SIGNAL b1x : signed(factors_width-1 downto 0);
SIGNAL b2x : signed(factors_width-1 downto 0);
SIGNAL b3x : signed(factors_width-1 downto 0);
SIGNAL b1y : signed(factors_width-1 downto 0);
SIGNAL b2y : signed(factors_width-1 downto 0);
SIGNAL b3y : signed(factors_width-1 downto 0);
 
COMPONENT colorconv
 
generic( DATA_WIDTH : INTEGER := 8);
port (
clk : IN STD_LOGIC;
rstn : IN STD_LOGIC;
 
DATA_ENA : IN STD_LOGIC;
DOUT_RDY : OUT STD_LOGIC;
 
-- input vector
x1 : IN UNSIGNED( data_width-1 downto 0 );
x2 : IN UNSIGNED( data_width-1 downto 0 );
x3 : IN UNSIGNED( data_width-1 downto 0 );
 
-- matrix factors
a11,a12,a13 : IN SIGNED( factors_width-1 downto 0 );
a21,a22,a23 : IN SIGNED( factors_width-1 downto 0 );
a31,a32,a33 : IN SIGNED( factors_width-1 downto 0 );
 
--shift vectors
b1x,b2x,b3x : IN SIGNED( factors_width-1 downto 0 );
b1y,b2y,b3y : IN SIGNED( factors_width-1 downto 0 );
-- output vector
y1c : OUT SIGNED( int_factors_part-1 downto 0 );
y2c : OUT SIGNED( int_factors_part-1 downto 0 );
y3c : OUT SIGNED( int_factors_part-1 downto 0 );
 
y1 : OUT UNSIGNED( data_width-1 downto 0 );
y2 : OUT UNSIGNED( data_width-1 downto 0 );
y3 : OUT UNSIGNED( data_width-1 downto 0 )
);
END COMPONENT ;
 
begin
 
-- WB address decoder
process(wb_clk_i, wb_rst_i)
begin
if wb_rst_i='1' then
a11 <= (others=>'0');
a12 <= (others=>'0');
a13 <= (others=>'0');
a21 <= (others=>'0');
a22 <= (others=>'0');
a23 <= (others=>'0');
a31 <= (others=>'0');
a32 <= (others=>'0');
a33 <= (others=>'0');
b1x <= (others=>'0');
b2x <= (others=>'0');
b3x <= (others=>'0');
b1y <= (others=>'0');
b2y <= (others=>'0');
b3y <= (others=>'0');
 
elsif rising_edge(wb_clk_i) then
if wb_stb_i='1' then
if wb_we_i='1' then
 
case wb_adr_i is
when x"0" =>
a11 <= SIGNED(wb_dat_i(factors_width-1 downto 0));
when x"1" =>
a12 <= SIGNED(wb_dat_i(factors_width-1 downto 0));
when x"2" =>
a13 <= SIGNED(wb_dat_i(factors_width-1 downto 0));
when x"3" =>
a21 <= SIGNED(wb_dat_i(factors_width-1 downto 0));
when x"4" =>
a22 <= SIGNED(wb_dat_i(factors_width-1 downto 0));
when x"5" =>
a23 <= SIGNED(wb_dat_i(factors_width-1 downto 0));
when x"6" =>
a31 <= SIGNED(wb_dat_i(factors_width-1 downto 0));
when x"7" =>
a32 <= SIGNED(wb_dat_i(factors_width-1 downto 0));
when x"8" =>
a33 <= SIGNED(wb_dat_i(factors_width-1 downto 0));
when x"9" =>
b1x <= SIGNED(wb_dat_i(factors_width-1 downto 0));
when x"A" =>
b2x <= SIGNED(wb_dat_i(factors_width-1 downto 0));
when x"B" =>
b3x <= SIGNED(wb_dat_i(factors_width-1 downto 0));
when x"C" =>
b1y <= SIGNED(wb_dat_i(factors_width-1 downto 0));
when x"D" =>
b2y <= SIGNED(wb_dat_i(factors_width-1 downto 0));
when x"E" =>
b3y <= SIGNED(wb_dat_i(factors_width-1 downto 0));
when others => null;
end case;
 
else
 
case wb_adr_i is
when x"0" =>
wb_dat_o <= STD_LOGIC_VECTOR(a11);
when x"1" =>
wb_dat_o <= STD_LOGIC_VECTOR(a12);
when x"2" =>
wb_dat_o <= STD_LOGIC_VECTOR(a13);
when x"3" =>
wb_dat_o <= STD_LOGIC_VECTOR(a21);
when x"4" =>
wb_dat_o <= STD_LOGIC_VECTOR(a22);
when x"5" =>
wb_dat_o <= STD_LOGIC_VECTOR(a23);
when x"6" =>
wb_dat_o <= STD_LOGIC_VECTOR(a31);
when x"7" =>
wb_dat_o <= STD_LOGIC_VECTOR(a32);
when x"8" =>
wb_dat_o <= STD_LOGIC_VECTOR(a33);
when x"9" =>
wb_dat_o(factors_width-1 downto 0) <= STD_LOGIC_VECTOR(b1x);
when x"A" =>
wb_dat_o(factors_width-1 downto 0) <= STD_LOGIC_VECTOR(b2x);
when x"B" =>
wb_dat_o(factors_width-1 downto 0) <= STD_LOGIC_VECTOR(b3x);
when x"C" =>
wb_dat_o(factors_width-1 downto 0) <= STD_LOGIC_VECTOR(b1y);
when x"D" =>
wb_dat_o(factors_width-1 downto 0) <= STD_LOGIC_VECTOR(b2y);
when x"E" =>
wb_dat_o(factors_width-1 downto 0) <= STD_LOGIC_VECTOR(b3y);
when others => null;
end case;
end if;
end if;
end if;
end process;
 
converter:colorconv
GENERIC MAP( DATA_WIDTH)
PORT MAP (x_clk, x_rstn, x_we_i, y_rdy_o,
x1_i, x2_i, x3_i,
a11, a12, a13,
a21, a22, a23,
a31, a32, a33,
b1x, b2x, b3x,
b1y, b2y, b3y,
y1c_o, y2c_o, y3c_o,
y1_o, y2_o, y3_o
);
end a;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.