axi_hdmi_rx: Move TPM to its own module

Move the test pattern matcher to its own module. This makes it easier to
use it in other configurations as well.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
main
Lars-Peter Clausen 2015-06-26 11:00:44 +02:00
parent ab6ea2c824
commit fcb841d3e5
3 changed files with 86 additions and 25 deletions

View File

@ -109,9 +109,6 @@ module axi_hdmi_rx_core (
reg hdmi_de_444_p = 'd0; reg hdmi_de_444_p = 'd0;
reg [31:0] hdmi_data_444_p = 'd0; reg [31:0] hdmi_data_444_p = 'd0;
reg hdmi_dma_enable = 'd0; reg hdmi_dma_enable = 'd0;
reg [15:0] hdmi_tpm_data = 'd0;
reg hdmi_tpm_mismatch = 'd0;
reg hdmi_tpm_oos = 'd0;
reg [15:0] hdmi_vs = 'd0; reg [15:0] hdmi_vs = 'd0;
reg [15:0] hdmi_hs = 'd0; reg [15:0] hdmi_hs = 'd0;
reg hdmi_vs_oos = 'd0; reg hdmi_vs_oos = 'd0;
@ -134,8 +131,6 @@ module axi_hdmi_rx_core (
// internal signals // internal signals
wire [15:0] hdmi_tpm_data_s;
wire hdmi_tpm_mismatch_s;
wire hdmi_sof_s; wire hdmi_sof_s;
wire hdmi_sof_ss_s; wire hdmi_sof_ss_s;
wire hdmi_de_ss_s; wire hdmi_de_ss_s;
@ -240,26 +235,6 @@ module axi_hdmi_rx_core (
end end
end end
// tpm
assign hdmi_tpm_data_s[15:8] = (hdmi_tpm_data[15:8] < 8'h10) ? 8'h10 :
((hdmi_tpm_data[15:8] > 8'heb) ? 8'heb : hdmi_tpm_data[15:8]);
assign hdmi_tpm_data_s[ 7:0] = (hdmi_tpm_data[ 7:0] < 8'h10) ? 8'h10 :
((hdmi_tpm_data[ 7:0] > 8'heb) ? 8'heb : hdmi_tpm_data[ 7:0]);
assign hdmi_tpm_mismatch_s = (hdmi_tpm_data_s == hdmi_data_422) ? 1'b0 : 1'b1;
always @(posedge hdmi_clk) begin
if (hdmi_sof_s == 1'b1) begin
hdmi_tpm_data <= 16'd0;
hdmi_tpm_mismatch <= 1'd0;
hdmi_tpm_oos <= hdmi_tpm_mismatch;
end else if (hdmi_de_422 == 1'b1) begin
hdmi_tpm_data <= hdmi_tpm_data + 1'b1;
hdmi_tpm_mismatch <= hdmi_tpm_mismatch_s;
hdmi_tpm_oos <= hdmi_tpm_oos;
end
end
// horizontal and vertical sync counters, active video size & mismatch // horizontal and vertical sync counters, active video size & mismatch
always @(posedge hdmi_clk) begin always @(posedge hdmi_clk) begin
@ -367,6 +342,15 @@ module axi_hdmi_rx_core (
.hdmi_hs_de (hdmi_hs_de_s), .hdmi_hs_de (hdmi_hs_de_s),
.hdmi_data_de (hdmi_data_de_s)); .hdmi_data_de (hdmi_data_de_s));
// test patttern matcher
axi_hdmi_rx_tpm i_tpm (
.hdmi_clk (hdmi_clk),
.hdmi_sof (hdmi_sof_422),
.hdmi_de (hdmi_de_422),
.hdmi_data (hdmi_data_422),
.hdmi_tpm_oos(hdmi_tpm_oos));
endmodule endmodule
// *************************************************************************** // ***************************************************************************

View File

@ -18,6 +18,7 @@ adi_ip_files axi_hdmi_rx [list \
"$ad_hdl_dir/library/common/up_hdmi_rx.v" \ "$ad_hdl_dir/library/common/up_hdmi_rx.v" \
"axi_hdmi_rx.v" \ "axi_hdmi_rx.v" \
"axi_hdmi_rx_es.v" \ "axi_hdmi_rx_es.v" \
"axi_hdmi_rx_tpm.v" \
"axi_hdmi_rx_constr.xdc" \ "axi_hdmi_rx_constr.xdc" \
"axi_hdmi_rx_core.v" ] "axi_hdmi_rx_core.v" ]

View File

@ -0,0 +1,76 @@
// ***************************************************************************
// ***************************************************************************
// Copyright 2011-2015(c) Analog Devices, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
// - Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// - Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in
// the documentation and/or other materials provided with the
// distribution.
// - Neither the name of Analog Devices, Inc. nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
// - The use of this software may or may not infringe the patent rights
// of one or more patent holders. This license does not release you
// from the requirement that you obtain separate licenses from these
// patent holders to use this software.
// - Use of the software either in source or binary form, must be run
// on or directly connected to an Analog Devices Inc. component.
//
// THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
// INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A
// PARTICULAR PURPOSE ARE DISCLAIMED.
//
// IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, INTELLECTUAL PROPERTY
// RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// ***************************************************************************
// ***************************************************************************
module axi_hdmi_rx_tpm (
hdmi_clk,
hdmi_sof,
hdmi_de,
hdmi_data,
hdmi_tpm_oos);
input hdmi_clk;
input hdmi_sof;
input hdmi_de;
input [15:0] hdmi_data;
output hdmi_tpm_oos;
wire [15:0] hdmi_tpm_data_s;
wire hdmi_tpm_mismatch_s;
reg [15:0] hdmi_tpm_data = 'd0;
reg hdmi_tpm_mismatch = 'd0;
reg hdmi_tpm_oos = 'd0;
assign hdmi_tpm_data_s[15:8] = (hdmi_tpm_data[15:8] < 8'h10) ? 8'h10 :
((hdmi_tpm_data[15:8] > 8'heb) ? 8'heb : hdmi_tpm_data[15:8]);
assign hdmi_tpm_data_s[ 7:0] = (hdmi_tpm_data[ 7:0] < 8'h10) ? 8'h10 :
((hdmi_tpm_data[ 7:0] > 8'heb) ? 8'heb : hdmi_tpm_data[ 7:0]);
assign hdmi_tpm_mismatch_s = (hdmi_tpm_data_s == hdmi_data) ? 1'b0 : 1'b1;
always @(posedge hdmi_clk) begin
if (hdmi_sof == 1'b1) begin
hdmi_tpm_data <= 16'd0;
hdmi_tpm_mismatch <= 1'd0;
hdmi_tpm_oos <= hdmi_tpm_mismatch;
end else if (hdmi_de == 1'b1) begin
hdmi_tpm_data <= hdmi_tpm_data + 1'b1;
hdmi_tpm_mismatch <= hdmi_tpm_mismatch | hdmi_tpm_mismatch_s;
end
end
endmodule