|
|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
MFSK调制系统设计和VHDL程序及仿真& [2 Q* A5 Z" p: `
U( i7 a" @( Y0 r" r3 @
8 A2 g- T+ i2 b2 w4 J7 w功能:基于VHDL硬件描述语言,完成对基带信号的MFSK调制
5 F7 ]* x( \% L+ N- \ v--说明:这里MFSK的M为4, D1 q2 _+ S5 y# n8 @. c
library ieee;
- Y& W0 P* l% E: A0 t, `1 F' i, Huse ieee.std_logic_arith.all;
; o1 e) \' C9 ?3 y* ]use ieee.std_logic_1164.all;- o0 x9 x7 A# H1 h
use ieee.std_logic_unsigned.all;
& \( [, h3 m1 c, V* U6 Bentity PL_MFSK is2 M8 C. n& j: ]; i6 c6 s
port(clk&nBSP; :in std_logic; --系统时钟& i8 K: m2 E3 S7 u( R4 l- r( {* ^
start :in std_logic; --开始调制信号( G9 _0 H1 K7 B- Y1 h# A7 l$ P
x :in std_logic; --基带信号2 b2 n; W, z2 v0 |; ^3 _* W% G
y ut std_logic); --调制信号) p& U1 e$ {% W0 v
end PL_MFSK;
# I5 ]) @+ G% Z4 y, f2 d! ?9 U. Darchitecture behav of PL_MFSK is( W0 @ v h! D; q) D3 Q
signal q :integer range 0 to 15; --计数器
9 ~2 `% H5 l0 Q1 {, U! M: |$ Isignal f :std_logic_vector(3 downto0); --分频器6 P2 Y8 N) O0 p) u- o# W
signal xx:std_logic_vector(1 downto0); --寄存输入信号x的2位寄存器
' [3 @6 k' i( [. ?signal yy:std_logic_vector(1 downto0); --寄存xx信号的寄存器 a) g4 O! H2 {/ m- Y+ y! c3 N8 H
begin2 x0 d0 i! j/ i- L8 \
process(clk) --此进程过对clk进行分频,得到4种载波信号f3、f2、f1、f0。
- J9 i A v! f- ], f* {begin
" Q: ~" g" b. y) l" `; t* nif clk'event and clk='1' then
9 q D6 b4 A% Y( k6 k1 O" C ifstart='0' then f<="0000";4 C! `/ K' y3 u! i4 l
elsiff="1111" then f<="0000";
l' b* X: L. O5 x Y else f<=f+1;6 u: B" @. @+ F$ |. v
end if;' H/ [6 O4 z8 R$ C
end if;, U9 ?" q4 _5 R1 `( R. O T- Z$ S. h
end process;
) x! Z# C. O7 J' z, ?) Q1 x2 Fprocess(clk) --对输入的基带信号x进行串/并转换,得到2位并行信号的yy8 B1 ] V8 Q. v' k+ O; q! X
begin. p0 c' C! _) M
if clk'event and clk='1' then" m6 b& F. I$ x# ~6 ]4 o! Q
ifstart='0' then q<=0;$ M. ~+ R& _1 V5 f
elsif q=0 then q<=1;xx(1)<=x;yy<=xx;
1 ~% q2 U, l& t& l elsif q=8 then q<=9;xx(0)<=x; W! X3 j7 `7 _; Y, \
else q<=q+1;* a* Z2 s0 @' f1 m* R% e
end if;
3 C7 N) h( {& \* T5 s0 H# ^end if;) t: U) }) P9 g8 n$ e6 k
end process;% F! \* m; \( X8 ]& h) J
process(clk,yy) --此进程完成对输入基带信号x的MFSK调制
% k9 a( F/ t7 I! @: Jbegin
# T, d, @3 T- }% Zif clk'event and clk='1' then
) A' S. U# M7 n0 _' N h4 P/ t7 q ifstart='0' then y<='0'; -- if语句完成2位码并行码到4种载波的选通# W9 d( u. }6 h( i; w
elsif yy="00" then y<=not f(3);( Y: P e* N4 \( k# W0 A
elsif yy="01" then y<=not f(2);
$ ^) Z" Z2 h; U! Y, ~6 M4 f elsif yy="10" then y<=not f(1);6 v- D- S1 W% \% {% P( D
else y<=not f(0);' }" y* S) b5 ] r, M) ~2 K5 l
end if;
2 u9 @( B ?7 g1 B7 E2 X# s1 Z1 Bend if;: Q5 v; U" m. }. f$ ]$ M
end process;
; Z0 s$ v2 u _1 R5 m# ]& aend behav;
( y9 F w! |: X# t |
|