|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
MFSK调制系统设计和VHDL程序及仿真( _: `2 a `1 `
* R- ?7 P! z9 g4 o5 Q% d9 O3 F! K, _, o+ y/ M1 F. y, S2 F
功能:基于VHDL硬件描述语言,完成对基带信号的MFSK调制8 [2 b6 N& t0 X4 o9 d! ~7 ~
--说明:这里MFSK的M为4- x* u2 i3 {6 l5 U: U; d6 _. o
library ieee;+ z1 n; V2 Z' ?6 y
use ieee.std_logic_arith.all;5 [& P; P" a9 i" U
use ieee.std_logic_1164.all;# [( z; |+ `* i, M7 ?/ a! [
use ieee.std_logic_unsigned.all;
0 P9 d5 r! T* ^entity PL_MFSK is
6 o8 \, z4 \! Yport(clk&nBSP; :in std_logic; --系统时钟/ m0 C& R* N) h! [" Y# I7 Q
start :in std_logic; --开始调制信号
/ ^' x* O* {" g. M& H! k4 n x :in std_logic; --基带信号
, _8 F% y6 o7 b! a! x; Q+ n y ut std_logic); --调制信号
" [ @: t5 I. r" V, ?8 W' e! M" Fend PL_MFSK;3 S( d& x9 h4 ^& S; _6 t4 I
architecture behav of PL_MFSK is% P0 V i2 O% Z3 _9 K
signal q :integer range 0 to 15; --计数器
* b8 ?( _/ }& i( F" V/ gsignal f :std_logic_vector(3 downto0); --分频器) A) V$ H$ R/ b7 N! _
signal xx:std_logic_vector(1 downto0); --寄存输入信号x的2位寄存器
; R _3 g( g0 ] @! B( ^! |7 \signal yy:std_logic_vector(1 downto0); --寄存xx信号的寄存器/ k! I( Y; t4 C$ }9 J
begin
) a/ ~6 S" M! Z# d/ Tprocess(clk) --此进程过对clk进行分频,得到4种载波信号f3、f2、f1、f0。2 `- H# Y- e& |# S4 G: z- {
begin( B% [5 m- m+ ~" W$ Q2 S; s
if clk'event and clk='1' then2 F$ o2 {( G, a" r0 w
ifstart='0' then f<="0000";/ V$ p( {& |! ]) D- G
elsiff="1111" then f<="0000";; i9 l9 G) Y! @' t) \
else f<=f+1;
# C! J) v" K7 O2 Q* }' [) c2 x: G end if;
& |! N. v8 ~4 s2 A1 D+ Hend if;7 R9 _+ w4 R$ z& s6 S& ]/ V
end process;
; H9 ^" U" c" V& V" b. Z; K5 cprocess(clk) --对输入的基带信号x进行串/并转换,得到2位并行信号的yy
: n* N% ?) z9 q5 Y* x1 Jbegin
! N. d: F+ D. v) Q# S0 ^0 l$ M' hif clk'event and clk='1' then
9 K% d' i/ [7 \- M ifstart='0' then q<=0;; b; y2 t1 C; T& [+ s! E
elsif q=0 then q<=1;xx(1)<=x;yy<=xx;
; z$ C0 m; s$ L, C elsif q=8 then q<=9;xx(0)<=x;
/ g# e/ T8 d {( E else q<=q+1;3 @6 e7 Z/ v# Y# y$ b$ s
end if;
% z# C- h3 c0 K( j4 L9 s' Y8 j) Zend if;
4 |1 J; O6 @5 d5 [end process;- f6 F! M# P6 h$ J3 t
process(clk,yy) --此进程完成对输入基带信号x的MFSK调制5 r* |" @" \) Y% U- c* o4 p
begin' L9 w7 ~; S) P1 ?# Y" \
if clk'event and clk='1' then
( z: b5 l: ]- G! ^/ m, z+ l) r0 i, E+ ^ ifstart='0' then y<='0'; -- if语句完成2位码并行码到4种载波的选通. u" b" Y/ _6 Y1 I; d) j7 S
elsif yy="00" then y<=not f(3);) j) P$ s: h' o" u' Y- z
elsif yy="01" then y<=not f(2);
/ d! k# u! t* t; g& W elsif yy="10" then y<=not f(1);
( X- o: z* s2 u3 j else y<=not f(0);$ C. G q6 f7 N. D7 e
end if;
1 A, Z4 L2 E: q9 z B/ Dend if;
8 `% M7 A2 m- B' h' h nend process;
& m0 l0 v& L) E. ^' V1 x( cend behav;6 [! m. }) x* l4 l5 t/ `
|
|