




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、课题名称:基于vhdl语言的5b6b编译系统设计班 级: 通信工程0902,0903 姓名学号:陈莹莹200954080209 巢楚颉200954080302 肖泉200954080208 指导教师:单老师 2011年11月日基于vhdl语言的5b6b编译系统设计摘要: mbnb 码是光纤通信系统中常用的码型之一, 本次设计了一种简单实用的5b6b 编码方法, 并提出了用a ltera开发系统的硬件描述语言vhdl 实现全数字5b6b 编译码电路的设计思想和方法, 最后给出了波形仿真结果。本文给出了针对该编码方法的除数字锁相环之外的一种简单方便的vhdl 语言设计方法。关键词: 5b6b 码;
2、 fpga; vhdl 语言; 波形仿真编码部分(encode5b6b):一、 5b6b 编码原理 mbnb码又叫分组码,是一类冗余二进制码,常见到的有1b2b、2b3b、4b5b、5b6b、8b10b等码型。它将输入的原始码流分成mb为一组的码字,然后在同样的时间内将其变换成n(nm)比特(nb)为一组的较长码字,最后以不归零或归零格式传输这些新码流。m和n均为正整数,一般是n=m+1。通过变换,线路码数率比原二进制码率提高了n/m倍。5b6b码为字母型平衡码中mbnb码的一种,其编码复杂性和比特冗余度之间是最合理的折中,因此使用较为普遍。在5b6b码中,5伟二进制码共有=32种不同的码字,
3、而6位二进制码共有64种不同的码字,必须从64种码字中选出适宜的码字去对应5b码的32种码字。首先引入不平衡度d(dispartty)的概念,它表示一个码字中“0”元数目减去“1”元数目的差值,差值为零的码字为零不平衡度码字。由于6b码码长为偶数,所以d必为偶数,即d为0,2,-2,4,-4,6,-6。在6b码的64个码字中,有20个零平衡度码字,可以代表20个5b码字。通常情况下,根据尽量选择低不平衡度码字的原则,找出d=2,-2的码字各有12种,为了使“0”码和“1”码出现的机会相同,可以把这些码字相对应的交替使用,用以代表5b码中另外的12个码字。这样编出来的6b码流中最大同符号连续数为
4、6,“0”码和“1”码出现的概率均等,各占50%,所以可以认为没有直流漂移。必须指出,根据不同目的(例如:直流分量最低或实现方法简单等)所提出的编码方案,所对应的编码表是不同的。在本文中,出于减少最大同符号连续数的考虑,采用表一所示的5b6b 编码表,表中巧妙的调整了正,负不均码与均等吗的对应关系(例如输入码子“7”,“24”的变换),使本码表得出的6b码流中最大的同符号连续数为5,使“0”、“1”的转换概率达到了0.5915,提高了定时信息的含量。 表一中,模式1和模式2分别由19个d=0的码字和13个rds=2,-2的码字组成。大多数mbnb 码都采用两种模式编码, 两种模式交替使码字中的
5、不均值为零。这种编码电路多采用可编程只读存储器prom 查找表的方法实现。下面是一种5b6b码的码表。 表一如下 所示:输入码字(5b)输出码字(6b)输入码字(5b)输出码字(6b)模式一模式二模式一模式二0000001100101100101610000110001110001100001110011100001171000111100101000120001011011010001018100101110100100103000111000111000111910011010011010011400100110101100100201010011010011010050010110010
6、110010121101010101010101016001101001101001102210110010110010110700111100111000111231011101011101010080100010101110100024110001110000110009010011010011010012511001011001011001100101010101010101026110100110100110101101011001011001011271101101101100101012011001011001011002811100011100011100130110110110
7、100010129111010111010010011401110101110000110301111001111000110015011110011100011103111111001101001101 二 5b6b 的编码电路设计 5b6b 编码电路的工作原理: 为了实现5b6b 编码, 本设计是以随机码作为输入的数字信号。因此, 完整的5b6b 编码电路包括分频电路、串并转换电路、编码电路和并串转换电路组成。 (1)五分频器:五分频 序列发生器的输入时钟脉冲五分频,从而可以实现每输入5bit的串行信号就同步转换输出出五位的并行信号,实现时钟信号的同步。library ieee;use i
8、eee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity cnt5 isport(clk5:in std_logic;newclk1:out std_logic);end;architecture exam of cnt5 issignal q:integer range 0 to 4;signal temp: std_logic;beginprocess(clk5)beginif clk5event and clk5=1 then -表示检测clock的上升沿if q=4 thenq=0; temp=1;else q=q+1;
9、temp=0;end if;end if;end process;newclk1=temp; -newclk1是用于五串变五并模块和编码部分的控制时钟end exam;五分频分频功能仿真波(2) 串并转换(5位串变5位并)(用循环移位实现)clk0来一次有效,y接收串行的数据就向右移一位,当五分频的信号clk5有效时把y输出。编码部分五串变五并程序:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity ser2par5to5 isport(clk5:in std_logic;shift_i
10、n:in std_logic;a:out std_logic_vector(4 downto 0);end ;architecture one of ser2par5to5 issignal q: std_logic_vector(4 downto 0);beginp1:process(clk5)beginif clk5event and clk5=1 thenq=shift_in & q(4 downto 1);end if;end process p1;aregregregregregregregregregregregregregregregregregregregregregregre
11、gregregregregregregregregregregregregregregregregregregregregregregregregregregregregregregregregregregregregregregregregregregreg=null;end case;end if;end process p1;p2:process(clk6)beginif clk6event and clk6=1 thenq=reg;end if;end process p2; end one;编码仿真波形如下:(4)六分频器:六分频 序列发生器的输入时钟脉冲六分频,从而可以实现每输入6
12、bit的并行信号就将其转换给变量。具体程序如下:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity cnt6 isport(clk6:in std_logic;cnter:out std_logic);end;architecture exam of cnt6 issignal q:std_logic_vector(2 downto 0);signal temp: std_logic;beginprocess(clk6)beginif clk6event and clk6=1 theni
13、f q=101 thenq=000; temp=1;else q=q+1; temp=0;end if;end if;end process;cnter=temp;end exam;六分频分频功能仿真波形图:(5)六位并变串转换 把编码实现的6位码,由并行转换为串行输出。library ieee;use ieee.std_logic_1164.all;entity par2ser6to6 isport (clk0,clk6: in std_logic;q : in std_logic_vector(5 downto 0);shift_out : out std_logic);end par2s
14、er6to6;architecture one of par2ser6to6 issignal n:integer range 0 to 5;signal reg:std_logic_vector(5 downto 0);beginp1:process(clk6,q)beginif clk6event and clk6=1 thenreg=q;end if;end process p1;process(clk0,reg,n)beginif clk0event and clk0=1thenif n=5 then n=0;else nshift_outshift_outshift_outshift
15、_outshift_outshift_outshift_out=x;end case;end process; end one;六位并到串 仿真波形图:解码部分(encode5b6b):一、解码原理 解码器与编码器基本相同,只是除去组别控制部分。 译码时,把送来的已变换的6b信号码流,每6比特并联为一组,作为prom的地址,然后读出5b码,再经过并-串变换还原为原来的信号码流。二 5b6b 的译码电路设计解码器包括5分频电路、6分频电路、串并转换电路、解码电路和并串转换电路组成。(1)译码部分六分频器(用于产生同步时钟信号):library ieee;use ieee.std_logic_11
16、64.all;use ieee.std_logic_unsigned.all;entity cnt6 isport(clk6:in std_logic;cnter:out std_logic);end;architecture exam of cnt6 issignal q:std_logic_vector(2 downto 0);signal temp: std_logic;beginprocess(clk6)beginif clk6event and clk6=1 thenif q=101 thenq=000; temp=1;else q=q+1; temp=0;end if;end if
17、;end process;cnter=temp;end exam;六分频分频功能仿真波形图:(2)串行转并行(6位串变6位并):library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity ser2par6to6 isport(clk6:in std_logic;shift_in:in std_logic;a:out std_logic_vector(5 downto 0);end ;architecture one of ser2par6to6 issignal q: std_logic_vec
18、tor(5 downto 0);beginp1:process(clk6)beginif clk6event and clk6=1 thenq=shift_in & q(5 downto 1);end if;end process p1;aregregregregregregregregregregregregregregregregregregregregregregregregregregregregregregreg null; end case; end if; end process; y=reg;end;仿真波形图:(4)译码部分的五分频器:library ieee;use iee
19、e.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity cnt5 isport(clk5:in std_logic;newclk1:out std_logic);end;architecture exam of cnt5 issignal q:integer range 0 to 4;signal temp: std_logic;beginprocess(clk5)beginif clk5event and clk5=1 thenif q=4 thenq=0; temp=1;else q=q+1;temp=0;end if;end
20、 if;end process;newclk1=temp;end exam;五分频分频功能仿真波形图:(6)五位并行转串行:library ieee;use ieee.std_logic_1164.all;entity par2ser5to5 isport (clk0,clk5: in std_logic;q : in std_logic_vector(4 downto 0);shift_out : out std_logic);end par2ser5to5;architecture one of par2ser5to5 issignal n:integer range 0 to 4;signal reg:std_logic_vector(4 downto 0);beginp1:process(clk5,q)beginif clk5event and clk
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 机械基础知识培训心得
- 司法鉴定人培训课件模板
- 新解读《GB-T 36588-2018过压保护安全装置 通 用数据》
- 去年河北省中考数学试卷
- 青岛盲校初中数学试卷
- 临朐高考数学试卷
- 莆田高三市三检数学试卷
- 柳市中考数学试卷
- 河道蓄水池建设方案
- 平顶山中考数学试卷
- 太阳能路灯采购安装方案投标文件(技术方案)
- 2025年离婚协议书版模板
- 采购制度及流程
- ISO13485质量体系培训讲义
- 2025年度化妆品品牌形象设计与传播合同
- 中国缓冲包装材料行业市场全景监测及投资前景展望报告
- 2025江苏南通市启东市不动产登记服务中心编外劳务人员招聘4人历年高频重点提升(共500题)附带答案详解
- 证券行业风险管理信息系统建设方案
- 维护国家安全构建平安校园
- DB3701T 15-2020 基层网格化服务管理规范
- DB31-T 1308-2021 粉尘爆炸重大事故隐患治理工程验收规范
评论
0/150
提交评论