-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
383 additions
and
356 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/* | ||
* layer_code.sv | ||
* | ||
* Created on: 2020-04-06 23:09 | ||
* Author: Jack Chen <redchenjs@live.com> | ||
*/ | ||
|
||
module layer_code( | ||
input logic clk_in, | ||
input logic rst_n_in, | ||
|
||
input logic wr_en_in, | ||
input logic wr_done_in, | ||
input logic [5:0] wr_addr_in, | ||
input logic [7:0] wr_data_in, | ||
input logic [3:0] wr_byte_en_in, | ||
|
||
input logic [ 7:0] t0h_cnt_in, | ||
input logic [ 7:0] t0l_cnt_in, | ||
input logic [ 7:0] t1h_cnt_in, | ||
input logic [ 7:0] t1l_cnt_in, | ||
input logic [15:0] rst_cnt_in, | ||
|
||
output logic ws2812_code_out | ||
); | ||
|
||
logic rd_en; | ||
logic [ 5:0] rd_addr; | ||
logic [31:0] rd_data; | ||
|
||
logic bit_rdy, bit_data, bit_done; | ||
|
||
ram64 ram64( | ||
.aclr(~rst_n_in), | ||
.byteena_a(wr_byte_en_in), | ||
.clock(clk_in), | ||
.data({wr_data_in, wr_data_in, wr_data_in, wr_data_in}), | ||
.rdaddress(rd_addr), | ||
.rden(rd_en), | ||
.wraddress(wr_addr_in), | ||
.wren(wr_en_in), | ||
.q(rd_data) | ||
); | ||
|
||
ws2812_ctrl ws2812_ctrl( | ||
.clk_in(clk_in), | ||
.rst_n_in(rst_n_in), | ||
|
||
.bit_done_in(bit_done), | ||
|
||
.wr_done_in(wr_done_in), | ||
.rd_data_in(rd_data), | ||
.rst_cnt_in(rst_cnt_in), | ||
|
||
.bit_rdy_out(bit_rdy), | ||
.bit_data_out(bit_data), | ||
|
||
.rd_en_out(rd_en), | ||
.rd_addr_out(rd_addr) | ||
); | ||
|
||
ws2812_code ws2812_code( | ||
.clk_in(clk_in), | ||
.rst_n_in(rst_n_in), | ||
|
||
.bit_rdy_in(bit_rdy), | ||
.bit_data_in(bit_data), | ||
|
||
.t0h_cnt_in(t0h_cnt_in), | ||
.t0l_cnt_in(t0l_cnt_in), | ||
.t1h_cnt_in(t1h_cnt_in), | ||
.t1l_cnt_in(t1l_cnt_in), | ||
|
||
.bit_done_out(bit_done), | ||
.bit_code_out(ws2812_code_out) | ||
); | ||
|
||
endmodule |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* layer_conf.sv | ||
* | ||
* Created on: 2020-04-29 20:16 | ||
* Author: Jack Chen <redchenjs@live.com> | ||
*/ | ||
|
||
module layer_conf( | ||
input logic clk_in, | ||
input logic rst_n_in, | ||
|
||
input logic wr_en_in, | ||
input logic [5:0] wr_addr_in, | ||
input logic [7:0] wr_data_in, | ||
|
||
output logic [ 7:0] t0h_cnt_out, | ||
output logic [ 7:0] t0l_cnt_out, | ||
output logic [ 7:0] t1h_cnt_out, | ||
output logic [ 7:0] t1l_cnt_out, | ||
output logic [15:0] rst_cnt_out | ||
); | ||
|
||
logic [ 7:0] t0h_cnt; | ||
logic [ 7:0] t0l_cnt; | ||
logic [ 7:0] t1h_cnt; | ||
logic [ 7:0] t1l_cnt; | ||
logic [15:0] rst_cnt; | ||
|
||
assign t0h_cnt_out = t0h_cnt; | ||
assign t0l_cnt_out = t0l_cnt; | ||
assign t1h_cnt_out = t1h_cnt; | ||
assign t1l_cnt_out = t1l_cnt; | ||
assign rst_cnt_out = rst_cnt; | ||
|
||
always_ff @(posedge clk_in or negedge rst_n_in) | ||
begin | ||
if (!rst_n_in) begin | ||
t0h_cnt <= 8'h00; | ||
t0l_cnt <= 8'h00; | ||
t1h_cnt <= 8'h00; | ||
t1l_cnt <= 8'h00; | ||
rst_cnt <= 16'h0000; | ||
end else begin | ||
if (wr_en_in) begin | ||
case (wr_addr_in[2:0]) | ||
3'h0: | ||
t0h_cnt <= wr_data_in; | ||
3'h1: | ||
t0l_cnt <= wr_data_in; | ||
3'h2: | ||
t1h_cnt <= wr_data_in; | ||
3'h3: | ||
t1l_cnt <= wr_data_in; | ||
3'h4: | ||
rst_cnt[15:8] <= wr_data_in; | ||
3'h5: | ||
rst_cnt[ 7:0] <= wr_data_in; | ||
endcase | ||
end | ||
end | ||
end | ||
|
||
endmodule |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.