集成电路技术分享

 找回密码
 我要注册

QQ登录

只需一步,快速开始

搜索
查看: 1894|回复: 5

刚开始学VHDL~求助啊~~~

[复制链接]
naplesfuc 发表于 2010-11-9 20:05:07 | 显示全部楼层 |阅读模式
library ieee;
use ieee.std_logic_1164.all;
entity fsq is
port
(
clk : in std_logic;
u    : out std_logic
);
end fsq;

architecture afsq of fsq is
signal p   : std_logic_vector(3 downto 0);
signal p0 : std_logic;
signal p1 : std_logic;
signal p2 : std_logic;
signal p3 : std_logic;

begin

process(clk)
begin
if clk'event and clk='1' then
p0<=not p0;
end if;
end process;

process(p0)
begin

if p0'event and p0='0' then
p1<=not p1;
end if;
end process;

process(p1)
begin
if p1'event and p1='0' then
p2<=not p2;
end if;
end process;

process(p2)
begin
if p2'event and p2='0' then
p3<=not p3;
end if;
end process;

p<=p3&p2&p1&p0;

process(p)
begin

if p="1000" then
p<="0000";
end if;

case p is
when "0000" => u<='0';
when "0001" => u<='1';
when "0010" => u<='1';
when "0011" => u<='0';
when "0100" => u<='1';
when "0101" => u<='1';
when "0110" => u<='1';
when "0111" => u<='1';
when others => null;
end case;

end process;
end afsq;
这个是我的程序。。刚开始学VHDL,我想做一个01101111序列发生器。。这么写就会提示1 errors:signal "p" has multiple sources。。。怎么改?
weibode01 发表于 2010-11-14 09:30:04 | 显示全部楼层
P的用法啊,p<=p3&p2&p1&p0,P是一个组合,P3,P2,P1这些都只是一个数,这个&是与的意思吗?我觉得不能当拼接来用吧。。。不太懂,我是学Verilog的。..求高手
nonghero 发表于 2010-12-5 20:54:34 | 显示全部楼层
好好看看VHDL语法吧。一个信号多驱动源了。vhdl是不支持对一个信号进行多重驱动。
yanxin85085 发表于 2010-12-13 23:32:57 | 显示全部楼层
p<=p3&p2&p1&p0;
这里的p变为signal p_i 试试吧
呵呵,很有想象力的程序。
寒邪 发表于 2011-3-11 20:32:57 | 显示全部楼层
路过,挣分.......
wujiaojiao1988 发表于 2011-3-18 11:05:55 | 显示全部楼层
建议你改用变量,在进程中变量比较好用。signal "p" has multiple sources。。。是不是指p为赋初值0
,1均有可能。
您需要登录后才可以回帖 登录 | 我要注册

本版积分规则

关闭

站长推荐上一条 /1 下一条

QQ|小黑屋|手机版|Archiver|fpga论坛|fpga设计论坛 ( 京ICP备20003123号-1 )

GMT+8, 2025-6-22 17:35 , Processed in 0.075245 second(s), 21 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表