Created
May 23, 2025 09:45
-
-
Save jpf91/48a21475b77ff3c2a79051f29c51235a to your computer and use it in GitHub Desktop.
Saw wave generator
This file contains hidden or 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
/* | |
* Saw wave generator | |
*/ | |
module oscillator( | |
input clk, | |
input rstn, | |
input[11:0] count_max, | |
output[7:0] data | |
); | |
reg[11:0] counter; | |
always @(posedge clk) begin | |
if (rstn == 0) begin | |
counter <= 0; | |
end else begin | |
counter <= counter + count_max; | |
end | |
end | |
assign data = counter[11:4]; | |
endmodule |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment