------------------------------------------------------------------------------- -- Copyright (c) 2001 Mentor Graphics Corporation -- -- This model is a component of the Mentor Graphics VHDL-AMS educational open -- source model library, and is covered by this license agreement. This model, -- including any updates, modifications, revisions, copies, and documentation -- are copyrighted works of Mentor Graphics. USE OF THIS MODEL INDICATES YOUR -- COMPLETE AND UNCONDITIONAL ACCEPTANCE OF THE TERMS AND CONDITIONS SET FORTH -- IN THIS LICENSE AGREEMENT. Mentor Graphics grants you a non-exclusive -- license to use, reproduce, modify and distribute this model, provided that: -- (a) no fee or other consideration is charged for any distribution except -- compilations distributed in accordance with Section (d) of this license -- agreement; (b) the comment text embedded in this model is included verbatim -- in each copy of this model made or distributed by you, whether or not such -- version is modified; (c) any modified version must include a conspicuous -- notice that this model has been modified and the date of modification; and -- (d) any compilations sold by you that include this model must include a -- conspicuous notice that this model is available from Mentor Graphics in its -- original form at no charge. -- -- THIS MODEL IS LICENSED TO YOU "AS IS" AND WITH NO WARRANTIES, EXPRESS OR -- IMPLIED. MENTOR GRAPHICS SPECIFICALLY DISCLAIMS ALL IMPLIED WARRANTIES OF -- MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. MENTOR GRAPHICS SHALL -- HAVE NO RESPONSIBILITY FOR ANY DAMAGES WHATSOEVER. ------------------------------------------------------------------------------- -- File : VCOAnalog.vhd -- Author : Mentor Graphics -- Created : 2001/07/11 -- Last update: 2003-05-13 ------------------------------------------------------------------------------- -- Description: Analog Voltage Controlled Oscillator ------------------------------------------------------------------------------- -- Revisions : -- Date Version Author Description -- 2001/07/11 1.0 Mentor Graphics Created -- 2003-04-29 1.1 Mentor Graphics Added differential output ------------------------------------------------------------------------------- library IEEE; use IEEE.math_real.all; use IEEE.electrical_systems.all; entity VCOAnalog is generic ( Kv : real := 100.0e3; -- VCO Gain [Hz/Volt] Fc : real := 1.0e6; -- center freq [Hz] Vc : voltage := 2.5; -- input voltage that gives fc [Volts] Vcmin : voltage := 0.0; -- control voltage mininum [Volts] Vcmax : voltage := 5.0; -- control voltage maximum [Volts] Vout_ampl : voltage := 1.0; -- amplitude of output [Volts] Vout_offset : voltage := 0.0 -- offset voltage of output [Volts] ); port ( terminal v_inp, v_inm, v_outp, v_outm : electrical); end entity VCOAnalog; ------------------------------------------------------------------------------- -- VCO Equation: -- Fout = Fc + Kv*Vin ------------------------------------------------------------------------------- architecture behavioral of VCOAnalog is quantity vout across iout through v_outp to v_outm; quantity vctrl across v_inp to v_inm; quantity phi : real; quantity vtmp : real; constant Kv_w : real := math_2_pi*Kv; -- convert gain to (Rad/s)/Volt constant wc : real := math_2_pi*Fc; -- convert freq to Rad/s begin if vctrl > Vcmax use -- test control voltage for limits vtmp == Vcmax; elsif vctrl < Vcmin use vtmp == Vcmin; else vtmp == vctrl; end use; if domain = quiescent_domain use phi == 0.0; else -- use one of the following equations depending on preference phi'dot == Fc + Kv*(vtmp-Vc); -- Calculate output Freq in Rad/s -- phi'dot == wc + Kv_w*(vtmp-Vc); -- Calculate output Freq in Hz end use; -- Use one of the following equations depending on phi'dot equation above vout == Vout_offset + Vout_ampl*cos(math_2_pi*phi); --vout == Vout_offset + Vout_ampl*cos(phi); end architecture behavioral; ------------------------------------------------------------------------------- -- Copyright (c) 2001 Mentor Graphics Corporation -------------------------------------------------------------------------------