Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.
The question isn't clear. Verilog can't describe analog waveforms, it can at best generate a numerical variable that represents a waveform and may be output by a DAC.
A sawtooth waveform would be simply represented by a counter that's continuously incremented with overflow.
In this case, I keep my suggestion how to generate a sawtooth waveform. To modify scaling and period, you may want to change the 1 increment of a simple counter to a specific number. Obviously, it will count at 50 MHz.
RAMP WAVE GENERATION
Code
`timescale 1ns / 1ps
module Ramp(Ramp,En,Clk,Rst);
output reg [7:0] Ramp;
input En,Clk,Rst;
always@(posedge Clk or posedge Rst)
begin
if (Rst)
Ramp<=0;
else begin
if (En)
begin
Ramp <= Ramp+1′b1;
end
end
end
endmodule
This is ramp wave code, could you please modify this to sawtooth wave form?
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.