-- Model of Binary Frequency Shift Keying (BFSK) modulator -- with digital input and analog output library IEEE; use IEEE.electrical_systems.all; use IEEE.STD_LOGIC_1164.all; use IEEE.MATH_REAL.all; entity bfsk is generic ( fc : real := 455.0e3; -- Mean carrier frequency delta_f : real := 5.0e3; -- Difference between low and high carrier frequency amp : voltage := 1.0; -- Amplitude of modulated signal offset : voltage := 0.0 -- output offset voltage ); port ( d_in : in std_logic; -- digital input terminal a_out : electrical -- output terminal ); end entity bfsk; architecture behavioral of bfsk is quantity vout across iout through a_out; -- output branch quantity phi : real; -- free quantity for angle in radians constant wc : real := math_2_pi*fc; -- convert fc to rad/s constant delta_w : real := math_2_pi*delta_f; -- convert delta_f to rad/s begin if (d_in = '0') use phi'dot == wc; -- set to carrier frequency elsif (d_in = '1') use phi'dot == wc + delta_w; -- set to carrier frequency + delta else phi'dot == 0.0; end use; vout == offset + amp*sin(phi); -- create sinusoidal output using phi end architecture behavioral;