工具软件实训报告项目名称: 曼彻斯特编解码器指导老师:系科:专业:姓名:学号:目录:一:实训要求 (2)二:实训原理 (2)三:实训思路 (3)四:实训步骤 (3)五:原理图、仿真结果图以及结论分析 (4)1、曼彻斯特编解码器(实现16bit数据得编解码) (4)1、1曼彻斯特编解码器电路原理图: (4)1、2模块详解 (4)1、3仿真图以及分析...................... 错误!未定义书签。
六:个人总结、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、11(1)通过学习原理图输入设计得方法掌握使用工具软件Quartus Ⅱ设计小型数字电路;(2)查阅文献,了解曼彻斯特编解码器得基本原理, 并提出在Quartus Ⅱ软件环境下用VHDL进行仿真得方案。
(3)完成设计对编码器得要求:能够对输入得16bit数据进行曼彻斯特编码,输入有时钟、使能、16bit并行数据、写信号等;输出有编码结束与曼彻斯特编码信号(都为1位信号)等。
(4)完成设计对解码器要求:能够把输入得串行曼彻斯特码解码成原先得并行数据,输入有时钟、曼彻斯特码输入(1bit)、使能信号等,输出有提取得同步时钟信号、解码完成(1bit),并行数据(16bit)等。
二:实训原理曼彻斯特编码,也叫做相位编码(PE),就是一个同步时钟编码技术,在以太网媒介系统中,被物理层使用来编码一个同步位流得时钟与数据。
它得每一个数据比特都就是由至少一次电压转换得形式所表示得。
在曼彻斯特编码中,每一位得中间有一跳变,位中间得跳变既作为时钟信号,又作为数据信号。
按照曼彻斯特码在IEEE 802、4(令牌总线)以及IEEE 802、3 (以太网)中得规定,本次实训将从高电平到低电平得跳变表示“0”,从低电平到高电平得跳变表示“1”。
以下为曼彻斯特编解码器得实现框图:有上图可知,此次得曼彻斯特编解码电路包括三个部分:信号产生部分、编码电路部分与解码电路部分。
其中,信号产生部分用来产生一个循环得16位二进制数据编码作为普通得信号输入;编码部分则将输入得信号编码为曼彻斯特码,然后输出显示;解码部分负责将获得得曼彻斯特码解码成普通得二进制数据编码。
三个相对独立得模块相互协同工作,共同完成曼彻斯特编解码得工作。
四:实训步骤(1)建立工程;(2)编写VHDL文件,建立目标器件;(3)绘制电路原理图并编译;(4)进行仿真以及分析仿真后得波形文件;(5)完成实训报告。
五:原理图、仿真结果图以及结论分析1、曼彻斯特编解码器(实现16bit数据得编解码)1、1曼彻斯特编解码器电路原理图:1、2模块详解1、2、1分频器模块library ieee;use ieee、std_logic_1164、all;use ieee、std_logic_unsigned、all;entity clks isport(clk:in std_logic; --基准时钟clk0,clk1,clk2:buffer std_logic); --分频出得三个时钟,分别输入循环编--码模块、曼彻斯特编码模块、曼彻斯特解码模块end clks;architecture behav of clks issignal a:integer:=0;signal b:integer:=0;beginprocess(clk)beginclk0<=clk;end process;process(clk)beginif clk'event and clk='1' thenif a=2 thena<=0;clk1<='1';elsea<=a+1;clk1<='0';end if;end if;end process;process(clk)beginif clk'event and clk='1' thenif b=5 thenb<=0;clk2<='1';elseb<=b+1;clk2<='0';end if;end if;end process;end behav;1、2、2循环编码模块library ieee;use ieee、std_logic_1164、all;use ieee、std_logic_unsigned、all; entity recycle isport(clk2:in std_logic;datain:out std_logic);end recycle;architecture behav of recycle issignal i:integer:=0;beginprocess(clk2)beginif clk2'event and clk2='1' thenif i=15 theni<=0;elsei<=i+1;end if;end if;end process;process(clk2)beginif clk2'event and clk2='1' thencase i iswhen 0 => datain<='1';when 1 => datain<='0';when 2 => datain<='1';when 3 => datain<='1';when 4 => datain<='0';when 5 => datain<='1';when 6 => datain<='0';when 7 => datain<='0';when 8 => datain<='0';when 9 => datain<='0';when 10 => datain<='1';when 11 => datain<='1';when 12 => datain<='0';when 13 => datain<='1';when 14 => datain<='0';when 15 => datain<='0';when others => datain<=null;end case;end if;end process;end behav;1、2、3曼彻斯特编码模块library ieee;use ieee、std_logic_1164、all;use ieee、std_logic_unsigned、all;entity mcode isport(clk1: in std_logic;datain: in std_logic;dataout: out std_logic);end mcode;architecture behav of mcode issignal con:std_logic_vector(1 downto 0); signal s:std_logic;beginprocess(clk1)beginif clk1'event and clk1='1' thenif datain='1' thencon<="01"; --上升沿表示'1'elsecon<="10"; --下降沿表示'0'end if;end if;end process;process(clk1)Beginif clk1'event and clk1='1' thenif s='1' thendataout<=con(1);s<=not s;elsedataout<=con(0);s<=not s;end if;end if;end process;end behav;说明:曼彻斯特码就是用“01”与“10”来表示普通二进制数据中得“1”与“0”得,因此在实际电路设计中,我们很容易产生一个与数据信号具有相同频率得检测时钟,用来对传入得数据信号进行检测。
当检测信号检测到输入信号就是“1”时,选择器就输出“01”给寄存器,由寄存器完成并串转化功能,然后再将串行数据输出;当输入信号就是“0”时,选择器就输出“10”给寄存器由寄存器完成并串转化功能,然后再将串行数据输出,这样,输出得串行数据就就是曼彻斯特码。
1、2、4曼彻斯特解码模块library ieee;use ieee、std_logic_1164、all;use ieee、std_logic_unsigned、all;entity mdecode isport(clk0:in std_logic;dedatain: in std_logic;dedataout:out std_logic;count: buffer std_logic_vector(2 downto 0));end mdecode;architecture behav of mdecode issignal con:std_logic_vector(1 downto 0);beginprocess(clk0)beginif clk0'event and clk0='1' thenif count=5 thencount<="000";elsecount<=count+1;end if;end if;end process;process(clk0)beginif clk0'event and clk0='1' thencon(1)<=con(0);con(0)<=dedatain;end if;end process;process(clk0)beginif clk0'event and clk0='1' thenif count=4 thenif con="10" thendedataout<='0';elsif con="01" thendedataout<='1';end if;end if;end if;end process;end behav;说明:曼彻斯特解码电路设计得关键就是如何准确地从曼彻斯特码得数据流中提取出“10”与“01”信号,并且把它们转换成普通二进制编码中得“0”与“1”。