VHDL语言对于CPLD的编程

来源:百度知道 编辑:UC知道 时间:2024/05/30 05:58:59
用VHDL语言实现某一个系统设计,要基于CPLD逻辑器件,具体不限,但是不要电梯控制,分频器,数字频率计,计数器,温度控制器等很多人都研究过的,可以是很简单很简单的一个算法,只要可以实现某个简单的逻辑功能就可以了,网上找来粘贴的不要,回答得好追加。
要源程序,150行左右

--原创
--cpld与电脑串行通信
----
library ieee; --本程序在把N设为信号时,接收的第一个信号不对,有待研究
--经研究有if就必须有else与之配对,否则会产生错误
--后来在将N设为变量时,经修改在38行加上了else,经验证正确
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith.all;
entity chuan is
port(clk0,clk1:in std_logic;
rxd:in std_logic;
led:out std_logic_vector(7 downto 0)
);
end chuan;
architecture one of chuan is
signal ready:std_logic; --接收信号
signal ready_fan:std_logic; --允许检测信号
signal N:integer range 0 to 8;
begin

process(rxd,ready_fan)
variable ready_flag:std_logic; --允许接收信号
begin
if ready_fan='1' then ready<='0';
ready_flag:='0'; --第8个数据接收完毕,关闭接收,允许检测
elsif rxd'event and rxd='0' and ready_flag='0' then --检测电平的变化,一旦高变低
rea