带 RGB 开关滤波器的 HDMI 直通
HDMI Pass Through with RGB Switch Filter
我对 VHDL 和 FPGA 还很陌生,并且遇到了困难。我目前正在 zybo z7-10 上开发视频过滤器,并开始使用本指南在板上创建 HDMI 直通:
https://github.com/dpaul24/hdmi_pass_through_ZyboZ7-10?_ga=2.34188391.796043983.1579510279-2100398226.1578999679
因此,在完成该工作后,我想做的就是能够影响视频输出。为此,我尝试将 rgb 24 位向量的最后 8 位设置为 0,从而从输出中移除所有蓝色。如果我尝试以下代码(有或没有进程块),我在 "if" 语句行
上收到语法错误
process is
begin
if sw ='0' then
vid_pData(7 downto 0) <= sw
end if;
end process;
问题是我似乎无法将它放在代码中的任何位置而不会导致错误。有人可以解释这里发生了什么吗?
完整代码如下:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
library UNISIM;
use UNISIM.VComponents.all;
entity hdmi_pass_top is
Port (
sysclk_i : in std_logic; -- 125MH System Clock Input
async_reset_i : in std_logic; -- Reset switch on board
-- HDMI In/Rx
tmds_rx_clk_p_i : in std_logic;
tmds_rx_clk_n_i : in std_logic;
tmds_rx_data_p_i : in std_logic_vector(2 downto 0);
tmds_rx_data_n_i : in std_logic_vector(2 downto 0);
hdmi_rx_hpd_o : out std_logic := '1'; -- HPD must be driven
-- I2C
sda_io : inout std_logic;
scl_io : inout std_logic;
-- HDMI Out/Tx
tmds_tx_clk_p_o : out std_logic;
tmds_tx_clk_n_o : out std_logic;
tmds_tx_data_p_o : out std_logic_vector(2 downto 0);
tmds_tx_data_n_o : out std_logic_vector(2 downto 0);
sw : in std_logic
);
end hdmi_pass_top;
architecture hdmi_pass_top_arc of hdmi_pass_top is
component dvi2rgb_0
port (
TMDS_Clk_p : in std_logic;
TMDS_Clk_n : in std_logic;
TMDS_Data_p : in std_logic_vector(2 downto 0);
TMDS_Data_n : in std_logic_vector(2 downto 0);
RefClk : in std_logic;
aRst : in std_logic;
vid_pData : out std_logic_vector(23 downto 0);
vid_pVDE : out std_logic;
vid_pHSync : out std_logic;
vid_pVSync : out std_logic;
PixelClk : out std_logic;
aPixelClkLckd : out std_logic;
SDA_I : in std_logic;
SDA_O : out std_logic;
SDA_T : out std_logic;
SCL_I : in std_logic;
SCL_O : out std_logic;
SCL_T : out std_logic;
pRst : in std_logic
);
end component;
component rgb2dvi_0
PORT (
TMDS_Clk_p : out std_logic;
TMDS_Clk_n : out std_logic;
TMDS_Data_p : out std_logic_vector(2 downto 0);
TMDS_Data_n : out std_logic_vector(2 downto 0);
aRst : in std_logic;
vid_pData : in std_logic_vector(23 downto 0);
vid_pVDE : in std_logic;
vid_pHSync : in std_logic;
vid_pVSync : in std_logic;
PixelClk : in std_logic
);
end component;
component clk_wiz_0
port
(-- Clock in ports
-- Clock out ports
clk_out1 : out std_logic;
-- Status and control signals
reset : in std_logic;
locked : out std_logic;
clk_in1 : in std_logic
);
end component;
signal vid_pData : std_logic_vector(23 downto 0);
signal vid_pVDE : std_logic;
signal vid_pHSync : std_logic;
signal vid_pVSync : std_logic;
signal pixelclk : std_logic;
signal locked : std_logic;
signal clk_200M : std_logic;
signal pixel_clk_sync_rst : std_logic;
signal sda_i : std_logic;
signal sda_o : std_logic;
signal sda_t : std_logic;
signal scl_i : std_logic;
signal scl_o : std_logic;
signal scl_t : std_logic;
begin
clkwiz_inst : clk_wiz_0
port map (
-- Clock out ports
clk_out1 => clk_200M,
-- Status and control signals
reset => async_reset_i,
locked => locked,
-- Clock in ports
clk_in1 => sysclk_i
);
dvi2rgb_inst : dvi2rgb_0
port map (
TMDS_Clk_p => tmds_rx_clk_p_i,
TMDS_Clk_n => tmds_rx_clk_n_i,
TMDS_Data_p => tmds_rx_data_p_i,
TMDS_Data_n => tmds_rx_data_n_i,
RefClk => clk_200M,
aRst => async_reset_i, --Active high asynchronous RefClk reset
vid_pData => vid_pData,
vid_pVDE => vid_pVDE,
vid_pHSync => vid_pHSync,
vid_pVSync => vid_pVSync,
PixelClk => pixelclk,
aPixelClkLckd => open, --
SDA_I => sda_i,
SDA_O => sda_o,
SDA_T => sda_t,
SCL_I => scl_i,
SCL_O => scl_o,
SCL_T => scl_t,
pRst => '0' -- Active high PixelClk synchronous reset
);
SDA_IOBUF_inst: IOBUF
generic map(
DRIVE => 12,
IOSTANDARD => "DEFAULT",
SLEW => "SLOW"
)
port map(
O => sda_i, -- Buffer output
IO => sda_io, -- Buffer inout port(connect directly to top-level port)
I => sda_o, -- Bufferinput
T => sda_t -- 3-state enable input,high=input,low=output
);
SCL_IOBUF_inst: IOBUF
generic map(
DRIVE => 12,
IOSTANDARD => "DEFAULT",
SLEW => "SLOW"
)
port map(
O => scl_i, -- Buffer output
IO => scl_io, -- Buffer inout port(connect directly to top-level port)
I => scl_o, -- Buffer input
T => scl_t -- 3-state enable input,high=input,low=output
);
rgb2dvi_inst : rgb2dvi_0
port map (
TMDS_Clk_p => tmds_tx_clk_p_o,
TMDS_Clk_n => tmds_tx_clk_n_o,
TMDS_Data_p => tmds_tx_data_p_o,
TMDS_Data_n => tmds_tx_data_n_o,
aRst => async_reset_i,
vid_pData => vid_pData,
vid_pVDE => vid_pVDE,
vid_pHSync => vid_pHSync,
vid_pVSync => vid_pVSync,
PixelClk => pixelclk
);
end hdmi_pass_top_arc;
编辑:将我的 if 语句更改为
vid_pData(7 downto 0) <= "00000000" when sw = '0';
它消除了错误,但实施失败。失败是:
[DRC MDRV-1] Multiple Driver Nets: Net
dvi2rgb_inst/U0/GenerateBUFG.ResyncToBUFG_X/vid_pData[0] has multiple
drivers: vid_pData_reg[0]/Q, and
dvi2rgb_inst/U0/GenerateBUFG.ResyncToBUFG_X/poData_reg[0]/Q.
您不是在编写软件,而是在设计硬件。您的额外代码驱动信号 vid_pData
。组件 dvi2rgb_0
也是如此。所以你在那个信号上有两个驱动程序。换句话说,短路。
此外,如果 sw
不等于 '0'
,您也没有说明 vid_pData
应该取什么值。因此,您将在硬件中获得锁存器。 (Google "inferring a latch".)
您需要一个新信号,例如:
signal vid_pData_new : std_logic_vector(23 downto 0);
那么你需要为sw
和'0'
和'1'
都赋值,否则你会得到一个latch:
vid_pData_new(7 downto 0) <= vid_pData(23 downto 8) & "00000000" when sw = '0' else vid_pData;
&
运算符是 concatenation 运算符。最后,您需要使用新信号驱动组件 rgb2dvi_0
:
rgb2dvi_inst : rgb2dvi_0
port map (
TMDS_Clk_p => tmds_tx_clk_p_o,
TMDS_Clk_n => tmds_tx_clk_n_o,
TMDS_Data_p => tmds_tx_data_p_o,
TMDS_Data_n => tmds_tx_data_n_o,
aRst => async_reset_i,
vid_pData => vid_pData_new, -- <-----------------
vid_pVDE => vid_pVDE,
vid_pHSync => vid_pHSync,
vid_pVSync => vid_pVSync,
PixelClk => pixelclk
);
你能看到这里做了什么吗?我们插入了一个驱动新信号 vid_pData_new
的新硬件,并为 sw
的两个可能值指定了它的值。我们必须这样做,否则我们会得到闩锁。我们正在设计硬件,而不是编写软件。
我对 VHDL 和 FPGA 还很陌生,并且遇到了困难。我目前正在 zybo z7-10 上开发视频过滤器,并开始使用本指南在板上创建 HDMI 直通: https://github.com/dpaul24/hdmi_pass_through_ZyboZ7-10?_ga=2.34188391.796043983.1579510279-2100398226.1578999679
因此,在完成该工作后,我想做的就是能够影响视频输出。为此,我尝试将 rgb 24 位向量的最后 8 位设置为 0,从而从输出中移除所有蓝色。如果我尝试以下代码(有或没有进程块),我在 "if" 语句行
上收到语法错误process is
begin
if sw ='0' then
vid_pData(7 downto 0) <= sw
end if;
end process;
问题是我似乎无法将它放在代码中的任何位置而不会导致错误。有人可以解释这里发生了什么吗?
完整代码如下:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
library UNISIM;
use UNISIM.VComponents.all;
entity hdmi_pass_top is
Port (
sysclk_i : in std_logic; -- 125MH System Clock Input
async_reset_i : in std_logic; -- Reset switch on board
-- HDMI In/Rx
tmds_rx_clk_p_i : in std_logic;
tmds_rx_clk_n_i : in std_logic;
tmds_rx_data_p_i : in std_logic_vector(2 downto 0);
tmds_rx_data_n_i : in std_logic_vector(2 downto 0);
hdmi_rx_hpd_o : out std_logic := '1'; -- HPD must be driven
-- I2C
sda_io : inout std_logic;
scl_io : inout std_logic;
-- HDMI Out/Tx
tmds_tx_clk_p_o : out std_logic;
tmds_tx_clk_n_o : out std_logic;
tmds_tx_data_p_o : out std_logic_vector(2 downto 0);
tmds_tx_data_n_o : out std_logic_vector(2 downto 0);
sw : in std_logic
);
end hdmi_pass_top;
architecture hdmi_pass_top_arc of hdmi_pass_top is
component dvi2rgb_0
port (
TMDS_Clk_p : in std_logic;
TMDS_Clk_n : in std_logic;
TMDS_Data_p : in std_logic_vector(2 downto 0);
TMDS_Data_n : in std_logic_vector(2 downto 0);
RefClk : in std_logic;
aRst : in std_logic;
vid_pData : out std_logic_vector(23 downto 0);
vid_pVDE : out std_logic;
vid_pHSync : out std_logic;
vid_pVSync : out std_logic;
PixelClk : out std_logic;
aPixelClkLckd : out std_logic;
SDA_I : in std_logic;
SDA_O : out std_logic;
SDA_T : out std_logic;
SCL_I : in std_logic;
SCL_O : out std_logic;
SCL_T : out std_logic;
pRst : in std_logic
);
end component;
component rgb2dvi_0
PORT (
TMDS_Clk_p : out std_logic;
TMDS_Clk_n : out std_logic;
TMDS_Data_p : out std_logic_vector(2 downto 0);
TMDS_Data_n : out std_logic_vector(2 downto 0);
aRst : in std_logic;
vid_pData : in std_logic_vector(23 downto 0);
vid_pVDE : in std_logic;
vid_pHSync : in std_logic;
vid_pVSync : in std_logic;
PixelClk : in std_logic
);
end component;
component clk_wiz_0
port
(-- Clock in ports
-- Clock out ports
clk_out1 : out std_logic;
-- Status and control signals
reset : in std_logic;
locked : out std_logic;
clk_in1 : in std_logic
);
end component;
signal vid_pData : std_logic_vector(23 downto 0);
signal vid_pVDE : std_logic;
signal vid_pHSync : std_logic;
signal vid_pVSync : std_logic;
signal pixelclk : std_logic;
signal locked : std_logic;
signal clk_200M : std_logic;
signal pixel_clk_sync_rst : std_logic;
signal sda_i : std_logic;
signal sda_o : std_logic;
signal sda_t : std_logic;
signal scl_i : std_logic;
signal scl_o : std_logic;
signal scl_t : std_logic;
begin
clkwiz_inst : clk_wiz_0
port map (
-- Clock out ports
clk_out1 => clk_200M,
-- Status and control signals
reset => async_reset_i,
locked => locked,
-- Clock in ports
clk_in1 => sysclk_i
);
dvi2rgb_inst : dvi2rgb_0
port map (
TMDS_Clk_p => tmds_rx_clk_p_i,
TMDS_Clk_n => tmds_rx_clk_n_i,
TMDS_Data_p => tmds_rx_data_p_i,
TMDS_Data_n => tmds_rx_data_n_i,
RefClk => clk_200M,
aRst => async_reset_i, --Active high asynchronous RefClk reset
vid_pData => vid_pData,
vid_pVDE => vid_pVDE,
vid_pHSync => vid_pHSync,
vid_pVSync => vid_pVSync,
PixelClk => pixelclk,
aPixelClkLckd => open, --
SDA_I => sda_i,
SDA_O => sda_o,
SDA_T => sda_t,
SCL_I => scl_i,
SCL_O => scl_o,
SCL_T => scl_t,
pRst => '0' -- Active high PixelClk synchronous reset
);
SDA_IOBUF_inst: IOBUF
generic map(
DRIVE => 12,
IOSTANDARD => "DEFAULT",
SLEW => "SLOW"
)
port map(
O => sda_i, -- Buffer output
IO => sda_io, -- Buffer inout port(connect directly to top-level port)
I => sda_o, -- Bufferinput
T => sda_t -- 3-state enable input,high=input,low=output
);
SCL_IOBUF_inst: IOBUF
generic map(
DRIVE => 12,
IOSTANDARD => "DEFAULT",
SLEW => "SLOW"
)
port map(
O => scl_i, -- Buffer output
IO => scl_io, -- Buffer inout port(connect directly to top-level port)
I => scl_o, -- Buffer input
T => scl_t -- 3-state enable input,high=input,low=output
);
rgb2dvi_inst : rgb2dvi_0
port map (
TMDS_Clk_p => tmds_tx_clk_p_o,
TMDS_Clk_n => tmds_tx_clk_n_o,
TMDS_Data_p => tmds_tx_data_p_o,
TMDS_Data_n => tmds_tx_data_n_o,
aRst => async_reset_i,
vid_pData => vid_pData,
vid_pVDE => vid_pVDE,
vid_pHSync => vid_pHSync,
vid_pVSync => vid_pVSync,
PixelClk => pixelclk
);
end hdmi_pass_top_arc;
编辑:将我的 if 语句更改为
vid_pData(7 downto 0) <= "00000000" when sw = '0';
它消除了错误,但实施失败。失败是:
[DRC MDRV-1] Multiple Driver Nets: Net dvi2rgb_inst/U0/GenerateBUFG.ResyncToBUFG_X/vid_pData[0] has multiple drivers: vid_pData_reg[0]/Q, and dvi2rgb_inst/U0/GenerateBUFG.ResyncToBUFG_X/poData_reg[0]/Q.
您不是在编写软件,而是在设计硬件。您的额外代码驱动信号 vid_pData
。组件 dvi2rgb_0
也是如此。所以你在那个信号上有两个驱动程序。换句话说,短路。
此外,如果 sw
不等于 '0'
,您也没有说明 vid_pData
应该取什么值。因此,您将在硬件中获得锁存器。 (Google "inferring a latch".)
您需要一个新信号,例如:
signal vid_pData_new : std_logic_vector(23 downto 0);
那么你需要为sw
和'0'
和'1'
都赋值,否则你会得到一个latch:
vid_pData_new(7 downto 0) <= vid_pData(23 downto 8) & "00000000" when sw = '0' else vid_pData;
&
运算符是 concatenation 运算符。最后,您需要使用新信号驱动组件 rgb2dvi_0
:
rgb2dvi_inst : rgb2dvi_0
port map (
TMDS_Clk_p => tmds_tx_clk_p_o,
TMDS_Clk_n => tmds_tx_clk_n_o,
TMDS_Data_p => tmds_tx_data_p_o,
TMDS_Data_n => tmds_tx_data_n_o,
aRst => async_reset_i,
vid_pData => vid_pData_new, -- <-----------------
vid_pVDE => vid_pVDE,
vid_pHSync => vid_pHSync,
vid_pVSync => vid_pVSync,
PixelClk => pixelclk
);
你能看到这里做了什么吗?我们插入了一个驱动新信号 vid_pData_new
的新硬件,并为 sw
的两个可能值指定了它的值。我们必须这样做,否则我们会得到闩锁。我们正在设计硬件,而不是编写软件。