Professional Documents
Culture Documents
Theory:
Square wave:
It is non sinusoidal periodic waveform (which can be represented as an infinite, summation of
sinusoidal waves) in which the amplitude alternates at a steady frequency between fixed minimum and
maximum values, with the same duration at minimum and maximum. The transition between minimum
and maximum is instantaneous for an ideal square wave. In practice this is never achieved because of
physical limitation of the system that generates the waveform. The time taken for the signal to rise from
low level to high level and back again are called the rise time and fall time respectively.
Square waves are universally encountered in digital switching circuits and are naturally generated
by binary (two level) logic devices. They are used as timing references or clock signals because their
fast transition synchronous logic circuits at precisely determined intervals.
The DAC (AD 1222) is digital to analog convertor on Spartan 2 FPGA board. There are 4 DACs,
12 bit of each. Here separate enable pins are provided for each DAC to select any one of the four DACs
present in spartan2 board. In this Spartan 2 board 11 bits are sent from FPGA to DAC.
To get the square wave at the output of the DAC the digital input must be either 0 or 1. So we
get square wave as shown in following figure 1.
Algorithm:
1. Start
2. Declare signal count
3. Check the reset value, if reset=1 then set the count=0
4. Else for positive edge of the clock signal, increment signal s.
5. Check whether the MSB of the signal cnt1 is one or not.
6. If yes, then set the count=00000000000
VLSI Design and Technology
Ramp wave:
A waveform that is similar to a sawtooth waveform but difference is that it starts at zero level and
gradually rises to its peak level and then instantly drops back to zero level to form one cycle.
To get ramp wave at the output of DAC we have to increase DAC input by 1 from 00000000000
to 11111111111 at each positive edge of clock pulse. Then we get ramp wave as shown in following figure
2.
Algorithm:
1. Start.
2. Declare signal count.
3. Check the reset value, if reset=1 then set the output to zero.
4. Else for positive edge of the clock signal, increment the count by l.
5. Select any one of the 4 DACs with the Enable=1.
6. Assign count value to dataout.
7. Stop.
AD1222
VLSI Design and Technology
The input resistance at VREF (Figure 3) is always equal to RLDR (RLDR is the R/2R ladder characteristic
resistance and is equal to value R). Since RIN at the VREF pin is constant, the reference terminal can be
driven by a reference voltage or a reference current, ac or dc, of positive or negative polarity. (If a current
source is used, a low temperature coefficient external RFB is recommended to define scale factor.)
Calculations:
Conclusion:
VLSI Design and Technology
Code
Square Waveform:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity square_wave_prog is
Port ( clk,reset : in STD_LOGIC;
dataout : out STD_LOGIC_VECTOR(10 downto 0);
enable : out STD_LOGIC);
end square_wave_prog;
Ramp Waveform:
library IEEE;
VLSI Design and Technology
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity ramp_wave_prog is
Port ( clk,reset : in STD_LOGIC;
dataout : out STD_LOGIC_VECTOR(10 downto 0);
enable : out STD_LOGIC);
end ramp_wave_prog;