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
|
||||
);
|
||||
|
||||
reg [11:0] frame_counter;
|
||||
|
||||
// pixgen signals
|
||||
reg pixgen_start;
|
||||
reg [8:0] x;
|
||||
|
@ -22,7 +24,8 @@ module coordinator (
|
|||
.x(x),
|
||||
.y(y),
|
||||
.rgb(pix_rgb0),
|
||||
.done(pix_done[0])
|
||||
.done(pix_done[0]),
|
||||
.frame(frame_counter[11:4])
|
||||
);
|
||||
pixgen pix1 (
|
||||
.clk(clk),
|
||||
|
@ -30,7 +33,8 @@ module coordinator (
|
|||
.x(x),
|
||||
.y(y + 9'd32),
|
||||
.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
|
||||
state <= StateInit;
|
||||
end else begin
|
||||
frame_counter <= frame_counter + 1;
|
||||
state <= StateStartFrame;
|
||||
end
|
||||
end
|
||||
|
|
|
@ -52,6 +52,10 @@ module hub75e (
|
|||
|
||||
reg [7:0] 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
|
||||
counter <= counter + 1;
|
||||
|
@ -73,8 +77,8 @@ module hub75e (
|
|||
display_clk <= counter[0];
|
||||
if (~counter[0]) begin
|
||||
// the data from the previous cycle is now ready.
|
||||
panel_rgb0 <= pixbuf_data[2:0];
|
||||
panel_rgb1 <= pixbuf_data[5:3];
|
||||
// panel_rgb0 <= pixbuf_data[2:0];
|
||||
// panel_rgb1 <= pixbuf_data[5:3];
|
||||
// write it out!
|
||||
end else begin
|
||||
// update the bram address so it's ready at the next clock cycle.
|
||||
|
|
|
@ -7,6 +7,7 @@ module pixgen #(
|
|||
input start,
|
||||
input [X_DEPTH-1:0] x,
|
||||
input [Y_DEPTH-1:0] y,
|
||||
input [7:0] frame,
|
||||
output reg [RGB_DEPTH-1:0] rgb,
|
||||
output reg done
|
||||
);
|
||||
|
@ -16,7 +17,7 @@ module pixgen #(
|
|||
always @(posedge clk) begin
|
||||
if (start) begin
|
||||
done <= 1;
|
||||
rgb <= { 8'b0, x[7:0], y[7:0] };
|
||||
rgb <= { x[6:0], 1'b0, frame, y[5:0], 2'b0};
|
||||
end
|
||||
else done <= 0;
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue