added vivado-vitis uart workflow to lab3

This commit is contained in:
PurplePower
2023-12-25 23:40:26 +08:00
parent ffcc688d94
commit 5ecb75157a
14 changed files with 1379 additions and 1602 deletions

View File

@@ -25,5 +25,22 @@ module clock_control(
input enable_clk,
output clk_out
);
assign clk_out = clk_in & enable_clk;
// if clock is divided
localparam clk_div = 2; // clock is diveded by half of divisor
reg [3:0] cnt = 4'd0;
reg out = 1'b0;
always @(posedge clk_in) begin
cnt <= cnt + 4'd1;
if (cnt >= (clk_div - 1)) begin
out <= ~out;
cnt <= 0;
end
end
assign clk_out = out & enable_clk;
// original clock
// assign clk_out = clk_in & enable_clk;
endmodule