ImageVerifierCode 换一换
格式:DOCX , 页数:27 ,大小:168.21KB ,
资源ID:11345727      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/11345727.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(CRC计算VHDL代码级测试代码.docx)为本站会员(b****8)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

CRC计算VHDL代码级测试代码.docx

1、CRC计算VHDL代码级测试代码CRC Computation1 CRC Matrix Computation (Ref 1)1.1 Dimension of matrix is 4 (Ref 1)library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity testbench isGENERIC (DM : INTEGER := 3); -length of matrix minus 1-end testbench;architecture mtest of testbench istype m

2、atrix_type IS array (DM downto 0) of std_logic_vector (DM downto 0);type intem_matrix_type IS array (DM downto 0) of matrix_type;signal a,b,c: matrix_type;signal tm,tv:intem_matrix_type;-constant DM: integer:=3; -length of matrix minus 1-signal i,j,k,s,f: integer;begin test:process begin -a=(1,0,0,1

3、),(1,0,1,1),(1,0,0,0),(0,0,1,1); a=(1,1,0,0),(0,0,1,0),(0,0,0,1),(1,0,0,0); wait for 20 ns; b=a; wait for 20 ns; b=c; wait for 20 ns; b=c; wait for 20 ns; b=c; wait; end process test; -the 0 line- Line_all:FOR k in 0 to DM GENERATE Line_i:FOR i in 0 to DM GENERATE Elem_all_0: for j in 0 to DM GENERA

4、TE tm(k)(j)(i)=a(k)(i) and b(i)(j); END GENERATE Elem_all_0; END GENERATE Line_i; END GENERATE Line_all;-c(0)(0)=tm(0)(0)(0) xor tm(0)(0)(1) xor tm(0)(0)(2) xor tm(0)(0)(3);- allc: for k in 0 to DM generate outc: for j in 0 to DM generate tv(k)(j)(0)=tm(k)(j)(0); c_computation: for i in 0 to DM-1 ge

5、nerate tv(k)(j)(i+1)=tv(k)(j)(i) xor tm(k)(j)(i+1); end generate c_computation; c(k)(j)=tv(k)(j)(DM); end generate outc; end generate allc; end mtest;Figure 1. 计算结果图1.2 Original Version of VHDL code (Ref 1)library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity testbench isen

6、d testbench;architecture mtest of testbench istype matrix_type IS array (3 downto 0) of std_logic_vector (3 downto 0);type intem_matrix_type IS array (3 downto 0) of matrix_type;signal a,b,c: matrix_type;signal tm,tv:intem_matrix_type;constant DM: integer:=3; -length of matrix minus 1-signal i,j,k:

7、integer;begin test:process begin -a=(1,0,0,1),(1,0,1,1),(1,0,0,0),(0,0,1,1); a=(1,1,0,0),(0,0,1,0),(0,0,0,1),(1,0,0,0); wait for 20 ns; b=a; wait for 20 ns; b=c; wait for 20 ns; b=c; wait for 20 ns; b=c; wait; end process test; -the 0 line- Line_0:FOR i in 0 to DM GENERATE Elem_all_0: for j in 0 to

8、DM GENERATE tm(0)(j)(i)=a(0)(i) and b(i)(j); END GENERATE Elem_all_0; END GENERATE Line_0; tv(0)(0)(0)=tm(0)(0)(0); c_computation: for i in 0 to DM-1 generate tv(0)(0)(i+1)=tv(0)(0)(i) xor tm(0)(0)(i+1); end generate c_computation; c(0)(0)=tv(0)(0)(DM); -c(0)(0)=tm(0)(0)(0) xor tm(0)(0)(1) xor tm(0)

9、(0)(2) xor tm(0)(0)(3); c(0)(1)=tm(0)(1)(0) xor tm(0)(1)(1) xor tm(0)(1)(2) xor tm(0)(1)(3); c(0)(2)=tm(0)(2)(0) xor tm(0)(2)(1) xor tm(0)(2)(2) xor tm(0)(2)(3); c(0)(3)=tm(0)(3)(0) xor tm(0)(3)(1) xor tm(0)(3)(2) xor tm(0)(3)(3); -the 1 line- Line_1:FOR i in 0 to DM GENERATE Elem_all_1: for j in 0

10、to DM GENERATE tm(1)(j)(i)=a(1)(i) and b(i)(j); END GENERATE Elem_all_1; END GENERATE Line_1; c(1)(0)=tm(1)(0)(0) xor tm(1)(0)(1) xor tm(1)(0)(2) xor tm(1)(0)(3); c(1)(1)=tm(1)(1)(0) xor tm(1)(1)(1) xor tm(1)(1)(2) xor tm(1)(1)(3); c(1)(2)=tm(1)(2)(0) xor tm(1)(2)(1) xor tm(1)(2)(2) xor tm(1)(2)(3);

11、 c(1)(3)=tm(1)(3)(0) xor tm(1)(3)(1) xor tm(1)(3)(2) xor tm(1)(3)(3); -the 2 line- Line_2:FOR i in 0 to DM GENERATE Elem_all_2: for j in 0 to DM GENERATE tm(2)(j)(i)=a(2)(i) and b(i)(j); END GENERATE Elem_all_2; END GENERATE Line_2; c(2)(0)=tm(2)(0)(0) xor tm(2)(0)(1) xor tm(2)(0)(2) xor tm(2)(0)(3)

12、; c(2)(1)=tm(2)(1)(0) xor tm(2)(1)(1) xor tm(2)(1)(2) xor tm(2)(1)(3); c(2)(2)=tm(2)(2)(0) xor tm(2)(2)(1) xor tm(2)(2)(2) xor tm(2)(2)(3); c(2)(3)=tm(2)(3)(0) xor tm(2)(3)(1) xor tm(2)(3)(2) xor tm(2)(3)(3); -the 3 line- Line_3:FOR i in 0 to DM GENERATE Elem_all_3: for j in 0 to DM GENERATE tm(3)(j

13、)(i)=a(3)(i) and b(i)(j); END GENERATE Elem_all_3; END GENERATE Line_3; c(3)(0)=tm(3)(0)(0) xor tm(3)(0)(1) xor tm(3)(0)(2) xor tm(3)(0)(3); c(3)(1)=tm(3)(1)(0) xor tm(3)(1)(1) xor tm(3)(1)(2) xor tm(3)(1)(3); c(3)(2)=tm(3)(2)(0) xor tm(3)(2)(1) xor tm(3)(2)(2) xor tm(3)(2)(3); c(3)(3)=tm(3)(3)(0) x

14、or tm(3)(3)(1) xor tm(3)(3)(2) xor tm(3)(3)(3); end mtest;1.3 Dimension of matrix is 12 (Ref 1)library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity testbench isGENERIC (DM : INTEGER := 11); -length of matrix minus 1-end testbench;architecture mtest of testbench istype matr

15、ix_type IS array (DM downto 0) of std_logic_vector (DM downto 0);type intem_matrix_type IS array (DM downto 0) of matrix_type;signal a,b,c: matrix_type;signal tm,tv:intem_matrix_type;-constant DM: integer:=3; -length of matrix minus 1-signal i,j,k,s: integer;begin test:process begin a=(1,1,0,0,0,0,0

16、,0,0,0,0,0), -0- (0,0,1,0,0,0,0,0,0,0,0,0), -1- (0,0,0,1,0,0,0,0,0,0,0,0), -2- (0,0,0,0,1,0,0,0,0,0,0,0), -3- (0,0,0,0,0,1,0,0,0,0,0,0), -4- (0,0,0,0,0,0,1,0,0,0,0,0), -5- (0,0,0,0,0,0,0,1,0,0,0,0), -6- (0,0,0,0,0,0,0,0,1,0,0,0), -7- (1,0,0,0,0,0,0,0,0,1,0,0), -8- (1,0,0,0,0,0,0,0,0,0,1,0), -9- (1,0

17、,0,0,0,0,0,0,0,0,0,1), -10- (1,0,0,0,0,0,0,0,0,0,0,0) -11- ); wait for 20 ns; b=a; s=1; wait for 20 ns; b=c; s=2; wait for 20 ns; b=c; s=3; wait for 20 ns; b=c; s=4; wait for 20 ns; b=c; s=5; wait for 20 ns; b=c; s=6; wait for 20 ns; b=c; s=7; wait for 20 ns; b=c; s=8; wait for 20 ns; b=c; s=9; wait

18、 for 20 ns; b=c; s=10; wait for 20 ns; b=c; s=11; wait for 20 ns; b=c; s=12; wait for 20 ns; wait; end process test; -the 0 line- Line_all:FOR k in 0 to DM GENERATE Line_i:FOR i in 0 to DM GENERATE Elem_all_0: for j in 0 to DM GENERATE tm(k)(j)(i)=a(k)(i) and b(i)(j); END GENERATE Elem_all_0; END GE

19、NERATE Line_i; END GENERATE Line_all;-c(0)(0)=tm(0)(0)(0) xor tm(0)(0)(1) xor tm(0)(0)(2) xor tm(0)(0)(3);- allc: for k in 0 to DM generate outc: for j in 0 to DM generate tv(k)(j)(0)=tm(k)(j)(0); c_computation: for i in 0 to DM-1 generate tv(k)(j)(i+1)=tv(k)(j)(i) xor tm(k)(j)(i+1); end generate c_

20、computation; c(k)(j)=tv(k)(j)(DM); end generate outc; end generate allc; end mtest;1.4 Dimension of matrix is 16(CCITT: x16+x12+x5+1) (Ref 1)Figure 3. results of F16library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity testbench isGENERIC (DM : INTEGER := 15); -length of ma

21、trix minus 1-end testbench;architecture mtest of testbench istype matrix_type IS array (DM downto 0) of std_logic_vector (DM downto 0);type intem_matrix_type IS array (DM downto 0) of matrix_type;signal a,b,c: matrix_type;signal tm,tv:intem_matrix_type;signal i,j,k,s: integer;begin test:process begi

22、n a=(0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0), -0- (0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0), -1- (0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0), -2- (1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0), -3- (0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0), -4- (0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0), -5- (0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0), -6- (0,0,0,0,0,0,0,0,1,0,0,

23、0,0,0,0,0), -7- (0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0), -8- (0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0), -9- (1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0), -a- (0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0), -b- (0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0), -c- (0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0), -d- (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1), -e- (1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0) -f- ); wait for 20 ns; b=a; s=1; wait for 20 ns; b=c; s=2; wait for 20 ns; b=c; s=3; wait for 20 ns; b=c; s=4; wait for 20 ns; b=c; s=5; wait for 20 ns; b=c; s=6; wait for 20 ns; b=c; s=7; wait for 20 ns; b=c; s=8; wait for 20 ns; b=c; s=9; wait for 20 ns; b=c; s=1

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1