--------------------------------------------------------------------------------
-- Company:
-- Engineer:
--
-- Create Date: 21:59:14 06/11/2011
-- Design Name:
-- Module Name: E:/vhdl/crc/crc/tb.vhd
-- Project Name: crc
-- Target Device:
-- Tool versions:
-- Description:
--
-- VHDL Test Bench Created by ISE for module: crc_code
--
-- Dependencies:
--
-- Revision:
-- Revision 0.01 - File Created
-- Additional Comments:
--
-- Notes:
-- This testbench has been automatically generated using types std_logic and
-- std_logic_vector for the ports of the unit under test. Xilinx recommends
-- that these types always be used for the top-level I/O of a design in order
-- to guarantee that the testbench will bind correctly to the post-implementation
-- simulation model.
--------------------------------------------------------------------------------
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
USE ieee.std_logic_unsigned.all;
USE ieee.std_logic_textio.ALL;
USE STD.textio.all;
ENTITY tb IS
END tb;
ARCHITECTURE behavior OF tb IS
-- Component Declaration
COMPONENT crc_code----编码器声明
PORT(clk:in std_logic;
rst:in std_logic;
din:in std_logic;
din_dv:in std_logic;
dout:out std_logic;
dout_dv:out std_logic);
END COMPONENT;
COMPONENT frame_receive----帧解析声明
PORT(clk:in std_logic;
rst:in std_logic;
din:in std_logic;
dout:out std_logic;
dout_dv:out std_Logic);
END COMPONENT;
COMPONENT frame------组帧声明
PORT(clk:in std_logic;
rst :in std_logic;
din :in std_logic;
din_dv :in std_logic;
dout :out std_logic);
END COMPONENT;
COMPONENT crc_tx-----检测声明
PORT(clk:in std_logic;
rst:in std_logic;
din:in std_logic;
din_dv:in std_logic;
error:out std_logic);
END COMPONENT;
--Inputs
signal clk : std_logic := '0';
signal rst : std_logic := '0';
signal din : std_logic := '0';
signal din_dv : std_logic := '0';
--Outputs
signal error : std_logic:='0';
--temp signal
signal cnt:std_logic_vector(5 downto 0):="000000";
signal dout_c_f:std_Logic;
signal dout_dv_c_f:std_logic;
signal dout_f_fr:std_Logic;
signal dout_fr_ct:std_Logic;
signal dout_dv_fr_ct:std_logic;
signal din_y : std_logic := '0';
signal noise : std_logic := '0';
-- Clock period definitions
constant clk_period : time := 10 ns;
BEGIN
clk_process :process
begin
clk <= '0';
wait for clk_period/2;
clk <= '1';
wait for clk_period/2;
end process;
--------------------------------------读取文件
process
begin
rst <= '1' ; wait for 2 ns;
rst <= '0' ; wait ;
end process;
process(clk)
FILE datain : text open read_mode is "din_dv.txt";
VARIABLE fin1 : Line;
VARIABLE data_in : STD_LOGIC;
begin
if(clk'event and clk = '1')then
readline (datain,fin1);
read (fin1,data_in);
din_dv<=data_in;
end if;
end process;
process(clk)
FILE datain : text open read_mode is "din.txt";
VARIABLE fin1 : Line;
VARIABLE data_in : STD_LOGIC;
begin
if(clk'event and clk = '1')then
readline (datain,fin1);
read (fin1,data_in);
din_y<=data_in;
end if;
end process;
process(clk)
FILE datain : text open read_mode is "noise,txt";
VARIABLE fin1 : Line;
VARIABLE data_in : STD_LOGIC;
begin
if(clk'event and clk = '1')then
readline (datain,fin1);
read (fin1,data_in);
noise<=data_in;
end if;
end process;
din<=noise xor din_y;
-------------------------------------连线
u1: crc_code PORT MAP ( clk, rst, din, din_dv, dout_c_f, dout_dv_c_f);
u2: frame PORT MAP ( clk, rst, dout_c_f, dout_dv_c_f, dout_f_fr);
u3: frame_receive PORT MAP( clk, rst, dout_f_fr, dout_fr_ct, dout_dv_fr_ct);
u4: crc_tx PORT MAP ( clk, rst, dout_fr_ct, dout_dv_fr_ct, error);
END behavior;
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
基于vhdl的crc校验码编程 (165个子文件)
__stored_object_table__ 54KB
__stored_object_table__ 60B
__stored_objects__ 70KB
__stored_objects___StrTbl 22KB
_info 51B
_vmake 26B
tb.vhd.bak 3KB
crc_code.vhd.bak 3KB
crc_tb.vhd.bak 2KB
frame.vhd.bak 2KB
frame_receive.vhd.bak 2KB
crc_tx.cmd_log 590B
frame.cmd_log 116B
dpm_project_main 78B
dpm_project_main_StrTbl 30B
frame.fdo 294B
frame_wave.fdo 125B
Gc_RvReportViewer-Current-Module 27B
Gc_RvReportViewer-Current-Module_StrTbl 25B
Gc_RvReportViewer-Module-Data-crc_code 293B
Gc_RvReportViewer-Module-Data-crc_code_StrTbl 10KB
Gc_RvReportViewer-Module-Data-crc_tx 293B
Gc_RvReportViewer-Module-Data-crc_tx_StrTbl 10KB
Gc_RvReportViewer-Module-Data-frame 293B
Gc_RvReportViewer-Module-Data-frame_receive 293B
Gc_RvReportViewer-Module-Data-frame_receive_StrTbl 10KB
Gc_RvReportViewer-Module-Data-frame_StrTbl 10KB
Gc_RvReportViewer-Module-DataFactory-Default 297B
Gc_RvReportViewer-Module-DataFactory-Default_StrTbl 10KB
GuiProjectData 240B
GuiProjectData_StrTbl 366B
HDProject 201B
HDProject_StrTbl 23B
frame_summary.html 4KB
frame_receive_summary.html 4KB
crc_code_summary.html 3KB
crc_tx_summary.html 3KB
crc.ise 212KB
ise.lock 88B
.lso 6B
frame.lso 6B
crc_tx.lso 6B
crc.mpf 59KB
tb_crc.mpf 59KB
crc_code.mpf 56KB
tb.mpf 55KB
crc.cr.mti 3KB
tb_crc.cr.mti 2KB
crc_code.cr.mti 855B
tb.cr.mti 2B
NameMap 29B
NameMap_StrTbl 10B
frame.ngc 2KB
crc_tx.ngr 3KB
frame.ngr 2KB
crc.ntrc_log 474B
frame_receive_vhdl.prj 47B
crc_code_vhdl.prj 42B
crc_tx_vhdl.prj 40B
frame_vhdl.prj 39B
frame_receive.prj 31B
crc_code.prj 26B
crc_tx.prj 24B
frame.prj 23B
pepExtractor.prj 19B
hdpdeps.ref 1KB
hdllib.ref 592B
regkeys 344B
regkeys 218B
regkeys 159B
regkeys 142B
regkeys 51B
regkeys 49B
regkeys 48B
regkeys 48B
regkeys 48B
regkeys 48B
regkeys 48B
regkeys 47B
regkeys 47B
regkeys 46B
regkeys 46B
regkeys 46B
regkeys 46B
regkeys 44B
regkeys 44B
regkeys 44B
regkeys 44B
regkeys 44B
regkeys 44B
regkeys 43B
regkeys 43B
regkeys 43B
regkeys 35B
regkeys 0B
regkeys 0B
regkeys 0B
regkeys 0B
regkeys 0B
crc.restore 55KB
共 165 条
- 1
- 2
资源评论
- kantifa2012-08-09源程序和仿真代码都很齐全,很好的资源
- cviio2013-04-13源程序和仿真代码都很齐全,很好的资源
han3172700
- 粉丝: 2
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功