完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
扫一扫,分享给好友
package types is
subtype short is integer range 0 to 255; end types; use work.types.all; entity parity is port(in0 :in bit; in1 :in bit; in2 :in bit; in3 :in bit; in4 :in bit; in5 :in bit; in6 :in bit; in7 :in bit; EVEN_IN:in bit; ODD_IN :in bit; IN_READY:in bit; OUT_REQ:in bit; CLK :in bit; OUT_READY:out bit; ODD_OUT:out bit; EVEN_OUT:out bit); end parity; architecture algorithm of parity is begin process variable cond: boolean :=true; variable count: short; begin wait until CLK'EVENT and CLK='1' and IN_READY='1'; if EVEN_IN=ODD_IN then cond:=false; end if; count:=0; if in0='1' then count:=count+1; end if; if in1='1' then count:=count+1; end if; if in2='1' then count:=count+1; end if; if in3='1' then count:=count+1; end if; if in4='1' then count:=count+1; end if; if in5='1' then count:=count+1; end if; if in6='1' then count:=count+1; end if; if in7='1' then count:=count+1; end if; L1:while count>1 loop count:=count-2; end loop L1; if count=1 and ODD_IN='0' then cond:=false; end if; if count=0 and EVEN_IN='0' then cond:=false; end if; if count=1 then EVEN_OUT<='0'; ODD_OUT<='1'; else EVEN_OUT<='1'; ODD_OUT<='0'; end if; wait until CLK'EVENT and CLK='1' and OUT_REQ='1'; OUT_READY<='1'; wait until CLK'EVENT and CLK='1' and OUT_REQ='0'; OUT_READY<='0'; assert cond report "ODD_IN even_in error" severity warning; end process; end algorithm; |
|
相关推荐
|
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
1476 浏览 1 评论
1266 浏览 0 评论
矩阵4x4个按键,如何把识别结果按编号01-16(十进制)显示在两个七段数码管上?
1471 浏览 0 评论
920 浏览 0 评论
2272 浏览 0 评论
1447 浏览 35 评论
5631 浏览 113 评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-24 06:00 , Processed in 0.485604 second(s), Total 69, Slave 53 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号