Skip to content

Commit

Permalink
top_tb: keep grey box approach & read tmds values directly, fixes #7
Browse files Browse the repository at this point in the history
  • Loading branch information
sameer committed May 7, 2020
1 parent 8053047 commit 416bc3e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 45 deletions.
40 changes: 5 additions & 35 deletions test/top_tb/top_tb.sv
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,10 @@
module top_tb();

initial begin
$dumpvars(0, top_tb);
// #36036000000ps $finish; // Terminate simulation after ~2 frames are generated
#20ms $finish;
end

logic clk_original = 0;
logic [2:0] tmds_p;
logic tmds_clock_p;
logic [2:0] tmds_n;
logic tmds_clock_n;

top top (
.clk_original(clk_original),
.tmds_p(tmds_p),
.tmds_clock_p(tmds_clock_p),
.tmds_n(tmds_n),
.tmds_clock_n(tmds_clock_n)
);
top top ();

logic [9:0] cx = 858 - 4;
logic [9:0] cy = 524;
Expand Down Expand Up @@ -62,27 +48,11 @@ generate
end
endgenerate

logic [3:0] counter = 0;
always @(posedge top.clk_pixel_x10)
always @(posedge top.clk_pixel)
begin
assert (counter == top.hdmi.tmds_counter) else $fatal("Shift-out counter doesn't match decoder counter");
if (counter == 9)
begin
counter <= 0;
end
else
counter <= counter + 1'd1;

tmds_values[0][counter] <= tmds_p[0];
tmds_values[1][counter] <= tmds_p[1];
tmds_values[2][counter] <= tmds_p[2];

if (counter == 0)
begin
tmds_values[0][9:1] <= 9'dX;
tmds_values[1][9:1] <= 9'dX;
tmds_values[2][9:1] <= 9'dX;
end
tmds_values[0] <= top.hdmi.tmds[0];
tmds_values[1] <= top.hdmi.tmds[1];
tmds_values[2] <= top.hdmi.tmds[2];
end

logic [4:0] data_counter = 0;
Expand Down
1 change: 0 additions & 1 deletion top/pll.v
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
`timescale 1 ns / 100 ps

module pll (
input wire inclk0,
output reg c0 = 0,
output reg c1 = 1,
output reg c2 = 0
Expand Down
15 changes: 6 additions & 9 deletions top/top.sv
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
module top (
input logic clk_original,

output logic [2:0] tmds_p,
output logic tmds_clock_p,
output logic [2:0] tmds_n,
output logic tmds_clock_n
);
module top ();
logic [2:0] tmds_p;
logic tmds_clock_p;
logic [2:0] tmds_n;
logic tmds_clock_n;

logic clk_pixel;
logic clk_pixel_x10;
logic clk_audio;

pll pll(.inclk0(clk_original), .c0(clk_pixel_x10), .c1(clk_pixel), .c2(clk_audio));
pll pll(.c0(clk_pixel_x10), .c1(clk_pixel), .c2(clk_audio));

logic signed [15:0] audio_sample_word = 16'sd0; // Since the L-PCM audio is 2-channel by default, this is mono audio.
always @(posedge clk_audio) // Sawtooth wave generator
Expand Down

0 comments on commit 416bc3e

Please sign in to comment.