欧卡2中文社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

需要三步,才能开始

只需两步,慢速开始

玩欧卡就用莱仕达V10方向盘欧卡2入门方向盘选莱仕达V9莱仕达折叠便携游戏方向盘支架欢迎地图Mod入驻
查看: 2653|回复: 0
收起左侧

VHDL设计RS触发器时不定状态的表示

[复制链接]
script 发表于 2012-3-27 13:43 | 显示全部楼层 |阅读模式
VHDL编写RS触发器代码:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity exp_rs is
port( r,s:in std_logic;
  q,not_q:out std_logic);
end exp_rs;
architecture exp_rs_arch of exp_rs is
signal q1,nq1:std_logic;
begin
 process(r,s)
 begin
  if(s='0' and r='1') then --置0状态
   q1<='0';
   nq1<='1';
  elsif(s='1' and r='0') then --置1状态
   q1<='1';
   nq1<='0';
  elsif(s='1' and r='1') then  --不定状态
   q1<='x';
   nq1<='x';
  elsif(s='0' and r='0') then  --保持状态
   q1<=q1;
   nq1<=nq1;
  end if;
 end process;
q<=q1;
not_q<=nq1;
end exp_rs_arch;

按照实验教材上敲入代码,却发现分析综合时不能通过,有如下错误:
Error (10316): VHDL error at exp_rs.vhd(21): character ''x'' used but not declared for type "std_logic"

百度了一下,都说是用 x 表示不定态,但我的就是报错。。
试着将小写的x改成大写的 X 之后,就不报错了。

相关帖子

联系我们|手机版|欧卡2中国 ( 湘ICP备11020288号-1 )

GMT+8, 2024-4-27 17:57 , Processed in 0.044937 second(s), 9 queries , Redis On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

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