登录 免费注册 首页 | 行业黑名单 | 帮助
维库电子市场网
技术交流 | 电路欣赏 | 工控天地 | 数字广电 | 通信技术 | 电源技术 | 测控之家 | EMC技术 | ARM技术 | EDA技术 | PCB技术 | 嵌入式系统
驱动编程 | 集成电路 | 器件替换 | 模拟技术 | 新手园地 | 单 片 机 | DSP技术 | MCU技术 | IC 设计 | IC 产业 | CAN-bus/DeviceNe

这个data_ready 怎么用的?帮我看看,谢!

作者:小虫 栏目:EDA技术
这个data_ready 怎么用的?帮我看看,谢!
--    File NAME:  md.vhd
--      Version:  1.0
--         Date:  January 22, 2000
--        MODEL:  Manchester DECODER Chip
--
--      Company:  XILINX.html">XILINX
--
--
--   Disclaimer:  THESE DESIGNS ARE PROVIDED "AS IS" WITH NO WARRANTY
--                WHATSOEVER AND XILINX SPECIFICALLY DISCLAIMS ANY
--                IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR
--                A PARTICULAR PURPOSE, OR AGAINST INFRINGEMENT.
--
--                COPYRIGHT (c) 2000 XILINX.html">XILINX, Inc.
--                All rights reserved
--

library ieee ;
use ieee.std_logic_1164.all ;
use ieee.std_logic_arith.all ;

entity md is
PORT (rst,clk16x,mdi,rdn : in std_logic ;
    dout : out std_logic_vector (7 downto 0) ;
    data_ready : out std_logic
) ;
end md ;

architecture v1 of md is

signal clk1x_enable : std_logic ;
signal mdi1 : std_logic ;
signal mdi2 : std_logic ;
signal rsr : std_logic_vector (7 downto 0) ;
signal dout_i : std_logic_vector (7 downto 0) ;
signal no_bits_rcvd : unsigned (3 downto 0) ;
signal clkdiv : unsigned (3 downto 0) ;
signal nrz : std_logic ;
signal clk1x : std_logic ;
signal SAMPLE : std_logic ;

begin

-- Generate two FF register to accept serial Manchester data in

PROCESS (rst,clk16x)
begin
if rst = '1' then
mdi1 <= '0' ;
mdi2 <= '0' ;
elsif clk16x'event and clk16x = '1' then
mdi2 <= mdi1 ;
mdi1 <= mdi ;
end if ;
end PROCESS ;

-- Enable the clock when an edge on mdi is detected

PROCESS (rst,clk16x,mdi1,mdi2,no_bits_rcvd)
begin
if rst = '1' then
clk1x_enable <= '0' ;
elsif clk16x'event and clk16x = '1' then
if mdi1 = '0' and mdi2 = '1' then
clk1x_enable <= '1' ;
else if std_logic_vector(no_bits_rcvd) = "1101" then
clk1x_enable <= '0' ;
end if ;
end if ;
end if ;
end PROCESS ;

-- Center SAMPLE the data at 1/4 and 3/4 points in data cell

SAMPLE <= ((not clkdiv(3)) and (not clkdiv(2)) and clkdiv(1) and clkdiv(0)) or (clkdiv(3) and clkdiv(2) and (not clkdiv(1)) and (not clkdiv(0))) ;

-- Decode Manchester data into NRZ

PROCESS (rst,SAMPLE,mdi2,clk16x,no_bits_rcvd)
begin
if rst = '1' then
nrz <= '0' ;
elsif clk16x'event and clk16x = '1' then
if std_logic_vector(no_bits_rcvd) > "000" and SAMPLE = '1' then
nrz <= mdi2 xor clk1x ;
end if ;
end if ;
end PROCESS ;

-- Increment the clock

PROCESS (rst,clk16x,clk1x_enable,clkdiv)
begin
if rst = '1' then
clkdiv <= "0000" ;
elsif clk16x'event and clk16x = '1' then
if clk1x_enable = '1' then
clkdiv <= clkdiv + "0001" ;
end if ;
end if ;
end PROCESS ;

clk1x <= clkdiv(3) ;

-- Serial to parallel conversion

PROCESS (rst,clk1x,dout_i,nrz)
begin
if rst = '1' then
rsr <= "00000000" ;
elsif clk1x'event and clk1x = '1' then
rsr <= rsr(6 downto 0) & nrz ;
end if ;
end PROCESS ;

-- Transfer from shift to data register

PROCESS (rst,clk1x,no_bits_rcvd)
begin
if rst = '1' then
dout_i <= "00000000" ;
elsif clk1x'event and clk1x = '1' then
if std_logic_vector(no_bits_rcvd) = "1001" then
dout_i <= rsr ;
end if ;
end if ;
end PROCESS ;

-- Track no of bits rcvd for word size

PROCESS (rst,clk1x,clk1x_enable,no_bits_rcvd)
begin
if rst = '1' then
no_bits_rcvd <= "0000" ;
elsif clk1x'event and clk1x = '1' then
if (clk1x_enable = '0') then
no_bits_rcvd <= "0000" ;
else
no_bits_rcvd <= no_bits_rcvd + "0001" ;
end if ;
end if ;
end PROCESS ;

-- Generate data_ready status signal
--clk1x_enable 都为0了,clk1x还……?
PROCESS (rst,clk1x,clk1x_enable,rdn)
begin
if (rst = '1' or rdn = '0') then
data_ready <= '0' ;
elsif clk1x'event and clk1x = '1' then
if (clk1x_enable = '0') then
data_ready <= '1' ;
else data_ready <= '0' ;
end if ;
end if ;
end PROCESS ;

dout <= dout_i ;

end ;


2楼: >>参与讨论
小虫
自己顶,请高手:)
自己顶,请高手:)

参与讨论
昵称:
讨论内容:
 
 
相关帖子
ISE 下载求助
ps2键盘调试中遇到的问题
如何在fpga内实现反正切
求助:vhdl编译时出现下面的问题,请问高手怎么解决?
为什么 maxplus好的程序在 quartus里一堆警告
免费注册为维库电子开发网会员,参与电子工程师社区讨论,点此进入


Copyright © 1998-2006 www.dzsc.com 浙ICP证030469号