axi_hdmi_rx: Add full range support to the TPM

Check for both full range and limited range test-pattern sequences and only
if both don't match assert the tpm_oos signal.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
main
Lars-Peter Clausen 2015-06-30 17:52:10 +02:00
parent fcb841d3e5
commit fa15f8d0b5
1 changed files with 22 additions and 9 deletions

View File

@ -49,27 +49,40 @@ module axi_hdmi_rx_tpm (
input [15:0] hdmi_data; input [15:0] hdmi_data;
output hdmi_tpm_oos; output hdmi_tpm_oos;
wire [15:0] hdmi_tpm_data_s; wire [15:0] hdmi_tpm_lr_data_s;
wire hdmi_tpm_mismatch_s; wire hdmi_tpm_lr_mismatch_s;
wire [15:0] hdmi_tpm_fr_data_s;
wire hdmi_tpm_fr_mismatch_s;
reg [15:0] hdmi_tpm_data = 'd0; reg [15:0] hdmi_tpm_data = 'd0;
reg hdmi_tpm_mismatch = 'd0; reg hdmi_tpm_lr_mismatch = 'd0;
reg hdmi_tpm_fr_mismatch = 'd0;
reg hdmi_tpm_oos = 'd0; reg hdmi_tpm_oos = 'd0;
assign hdmi_tpm_data_s[15:8] = (hdmi_tpm_data[15:8] < 8'h10) ? 8'h10 : // Limited range
assign hdmi_tpm_lr_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]); ((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 : assign hdmi_tpm_lr_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]); ((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; assign hdmi_tpm_lr_mismatch_s = (hdmi_tpm_lr_data_s == hdmi_data) ? 1'b0 : 1'b1;
// Full range
assign hdmi_tpm_fr_data_s[15:8] = (hdmi_tpm_data[15:8] < 8'h01) ? 8'h01 :
((hdmi_tpm_data[15:8] > 8'hfe) ? 8'hfe : hdmi_tpm_data[15:8]);
assign hdmi_tpm_fr_data_s[ 7:0] = (hdmi_tpm_data[ 7:0] < 8'h01) ? 8'h01 :
((hdmi_tpm_data[ 7:0] > 8'hfe) ? 8'hfe : hdmi_tpm_data[ 7:0]);
assign hdmi_tpm_fr_mismatch_s = (hdmi_tpm_fr_data_s == hdmi_data) ? 1'b0 : 1'b1;
always @(posedge hdmi_clk) begin always @(posedge hdmi_clk) begin
if (hdmi_sof == 1'b1) begin if (hdmi_sof == 1'b1) begin
hdmi_tpm_data <= 16'd0; hdmi_tpm_data <= 16'd0;
hdmi_tpm_mismatch <= 1'd0; hdmi_tpm_lr_mismatch <= 1'd0;
hdmi_tpm_oos <= hdmi_tpm_mismatch; hdmi_tpm_fr_mismatch <= 1'd0;
hdmi_tpm_oos <= hdmi_tpm_lr_mismatch & hdmi_tpm_fr_mismatch;
end else if (hdmi_de == 1'b1) begin end else if (hdmi_de == 1'b1) begin
hdmi_tpm_data <= hdmi_tpm_data + 1'b1; hdmi_tpm_data <= hdmi_tpm_data + 1'b1;
hdmi_tpm_mismatch <= hdmi_tpm_mismatch | hdmi_tpm_mismatch_s; hdmi_tpm_lr_mismatch <= hdmi_tpm_lr_mismatch | hdmi_tpm_lr_mismatch_s;
hdmi_tpm_fr_mismatch <= hdmi_tpm_fr_mismatch | hdmi_tpm_fr_mismatch_s;
end end
end end