generated from maddiebusig/vivado-template-hog
Compare commits
No commits in common. "6418f366b38b605469e64b53ee2f7323254b84d1" and "53aee5878e184d05815ada057f7ee6d2470d46d0" have entirely different histories.
6418f366b3
...
53aee5878e
@ -2,5 +2,4 @@
|
|||||||
|
|
||||||
[main]
|
[main]
|
||||||
PART = xc7z007sclg400-1
|
PART = xc7z007sclg400-1
|
||||||
IP_REPO_PATHS = "IP/ UserIP/"
|
|
||||||
|
|
||||||
|
|||||||
@ -1,43 +0,0 @@
|
|||||||
`timescale 1ns/1ps
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @brief PWM controller for a single output
|
|
||||||
*
|
|
||||||
* @param WINDOW_REG_SIZE Window and duty register size in bits
|
|
||||||
*
|
|
||||||
* @param [in] clk PWM counter clock
|
|
||||||
* @param [in] rst Asynchronous reset
|
|
||||||
* @param [in] duty Duty cycle high time in number of clock cycles
|
|
||||||
* @param [in] window_width Number of clock cycles in a window
|
|
||||||
* @param [in] oen Output pulse enable
|
|
||||||
* @param [out] pulse Output pulse
|
|
||||||
*/
|
|
||||||
module pwm_core #(
|
|
||||||
WINDOW_REG_SIZE = 16
|
|
||||||
)(
|
|
||||||
input clk,
|
|
||||||
input rst,
|
|
||||||
input [WINDOW_REG_SIZE-1:0] duty,
|
|
||||||
input [WINDOW_REG_SIZE-1:0] window_width,
|
|
||||||
input oen,
|
|
||||||
output pulse
|
|
||||||
);
|
|
||||||
|
|
||||||
reg [WINDOW_REG_SIZE-1:0] duty_counter;
|
|
||||||
|
|
||||||
always @ (posedge(clk), rst) begin
|
|
||||||
if (rst)
|
|
||||||
duty_counter <= 0;
|
|
||||||
else if (duty_counter == window_width)
|
|
||||||
duty_counter <= 0;
|
|
||||||
else
|
|
||||||
duty_counter <= duty_counter + 1;
|
|
||||||
end
|
|
||||||
|
|
||||||
wire pulse_high;
|
|
||||||
|
|
||||||
assign pulse_high = (duty_counter < duty) ? 1'b1 : 1'b0;
|
|
||||||
assign pulse = oen ? pulse_high : 1'b0;
|
|
||||||
|
|
||||||
endmodule
|
|
||||||
|
|
||||||
@ -286,7 +286,7 @@ ipx::update_checksums [ipx::current_core]
|
|||||||
ipx::check_integrity [ipx::current_core]
|
ipx::check_integrity [ipx::current_core]
|
||||||
ipx::save_core [ipx::current_core]
|
ipx::save_core [ipx::current_core]
|
||||||
|
|
||||||
close_project -delete
|
close_project
|
||||||
|
|
||||||
puts "Done"
|
puts "Done"
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user