generated from saji/ecp5-template
fix bit-loading latency using comb logic
make frame counter for generating data
This commit is contained in:
parent
37dabd603a
commit
2a8c70bab2
|
@ -8,6 +8,8 @@ module coordinator (
|
||||||
output reg [4:0] display_addr
|
output reg [4:0] display_addr
|
||||||
);
|
);
|
||||||
|
|
||||||
|
reg [11:0] frame_counter;
|
||||||
|
|
||||||
// pixgen signals
|
// pixgen signals
|
||||||
reg pixgen_start;
|
reg pixgen_start;
|
||||||
reg [8:0] x;
|
reg [8:0] x;
|
||||||
|
@ -22,7 +24,8 @@ module coordinator (
|
||||||
.x(x),
|
.x(x),
|
||||||
.y(y),
|
.y(y),
|
||||||
.rgb(pix_rgb0),
|
.rgb(pix_rgb0),
|
||||||
.done(pix_done[0])
|
.done(pix_done[0]),
|
||||||
|
.frame(frame_counter[11:4])
|
||||||
);
|
);
|
||||||
pixgen pix1 (
|
pixgen pix1 (
|
||||||
.clk(clk),
|
.clk(clk),
|
||||||
|
@ -30,7 +33,8 @@ module coordinator (
|
||||||
.x(x),
|
.x(x),
|
||||||
.y(y + 9'd32),
|
.y(y + 9'd32),
|
||||||
.rgb(pix_rgb1),
|
.rgb(pix_rgb1),
|
||||||
.done(pix_done[1])
|
.done(pix_done[1]),
|
||||||
|
.frame(frame_counter[11:4])
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
@ -138,6 +142,7 @@ module coordinator (
|
||||||
if (display_addr == 31) begin
|
if (display_addr == 31) begin
|
||||||
state <= StateInit;
|
state <= StateInit;
|
||||||
end else begin
|
end else begin
|
||||||
|
frame_counter <= frame_counter + 1;
|
||||||
state <= StateStartFrame;
|
state <= StateStartFrame;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -52,6 +52,10 @@ module hub75e (
|
||||||
|
|
||||||
reg [7:0] pixnum;
|
reg [7:0] pixnum;
|
||||||
assign pixbuf_addr = {bcm_shift, pixnum};
|
assign pixbuf_addr = {bcm_shift, pixnum};
|
||||||
|
always @(*) begin
|
||||||
|
panel_rgb0 = pixbuf_data[2:0];
|
||||||
|
panel_rgb1 = pixbuf_data[5:3];
|
||||||
|
end
|
||||||
|
|
||||||
always_ff @(posedge clk) begin
|
always_ff @(posedge clk) begin
|
||||||
counter <= counter + 1;
|
counter <= counter + 1;
|
||||||
|
@ -73,8 +77,8 @@ module hub75e (
|
||||||
display_clk <= counter[0];
|
display_clk <= counter[0];
|
||||||
if (~counter[0]) begin
|
if (~counter[0]) begin
|
||||||
// the data from the previous cycle is now ready.
|
// the data from the previous cycle is now ready.
|
||||||
panel_rgb0 <= pixbuf_data[2:0];
|
// panel_rgb0 <= pixbuf_data[2:0];
|
||||||
panel_rgb1 <= pixbuf_data[5:3];
|
// panel_rgb1 <= pixbuf_data[5:3];
|
||||||
// write it out!
|
// write it out!
|
||||||
end else begin
|
end else begin
|
||||||
// update the bram address so it's ready at the next clock cycle.
|
// update the bram address so it's ready at the next clock cycle.
|
||||||
|
|
|
@ -7,6 +7,7 @@ module pixgen #(
|
||||||
input start,
|
input start,
|
||||||
input [X_DEPTH-1:0] x,
|
input [X_DEPTH-1:0] x,
|
||||||
input [Y_DEPTH-1:0] y,
|
input [Y_DEPTH-1:0] y,
|
||||||
|
input [7:0] frame,
|
||||||
output reg [RGB_DEPTH-1:0] rgb,
|
output reg [RGB_DEPTH-1:0] rgb,
|
||||||
output reg done
|
output reg done
|
||||||
);
|
);
|
||||||
|
@ -16,7 +17,7 @@ module pixgen #(
|
||||||
always @(posedge clk) begin
|
always @(posedge clk) begin
|
||||||
if (start) begin
|
if (start) begin
|
||||||
done <= 1;
|
done <= 1;
|
||||||
rgb <= { 8'b0, x[7:0], y[7:0] };
|
rgb <= { x[6:0], 1'b0, frame, y[5:0], 2'b0};
|
||||||
end
|
end
|
||||||
else done <= 0;
|
else done <= 0;
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue