完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
扫一扫,分享给好友
|
library ieee;
use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; entity xuanze is port( s,c:in integer range 0000 to 9999; s1,s2,s3,s4,c1,c2,c3,c4:buffer integer range 0 to 9); end; architecture one of xuanze is signal a1,a2,a3,a4,b1,b2,b3,b4:integer:=0; signal a:integer:=s; signal b:integer:=c; begin process(a,b) begin if(a>999 and a<=9999) then a<=a-1000;a1<=a1+1;s1<=a1; elsif(a>99 and a<=999) then a<=a-100;a2<=a2+1;s2<=a2; elsif(a>9 and a<=99) then a<=a-10;a3<=a3+1;s3<=a3; else a<=a-1; a4<=a4+1;s4<=a4; end if; if(b>999 and b<=9999) then b<=b-1000;b1<=b1+1;c1<=b1; elsif(b>99 and b<=999) then b<=b-100;b2<=b2+1;c2<=b2; elsif(b>9and b<=99) then b<=b-10;b3<=b3+1;c3<=b3; else b<=b-1;b4<=b4+1;c4<=b4; end if; end process; end one; 求助 |
|
相关推荐
2个回答
|
|
|
library ieee;
use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; entity xuanze is port( s,c:in integer range 0000 to 9999; s1,s2,s3,s4,c1,c2,c3,c4:buffer integer range 0 to 9); end; architecture one of xuanze is signal a1,a2,a3,a4,b1,b2,b3,b4:integer:=0; signal a:integer:=s; signal b:integer:=c; begin process(a,b) begin if(a>999 and a<=9999) then s1<=a/1000; s2<=(a rem 1000)/100; s3<=(a rem 100)/10; s4<=(a rem 10); elsif(a>99 and a<=999) then s1<=0; s2<=a/100; s3<=(a rem 100)/10; s4<=(a rem 10); elsif(a>9 and a<=99) then s1<=0; s2<=0; s3<=a / 10; s4<=(a rem 10); else s1<=0; s2<=0; s3<=0; s4<=a; end if; if(b>999 and b<=9999) then c1<=b/1000; c2<=(b rem 1000)/100; c3<=(b rem 100)/10; c4<=(b rem 10); elsif(b>99 and b<=999) then c1<=0; c2<=b/100; c3<=(b rem 100)/10; c4<=(b rem 10); elsif(b>9 and b<=99) then c1<=0; c2<=0; c3<=b / 10; c4<=(b rem 10); else c1<=0; c2<=0; c3<=0; c4<=b; end if; end process; end one; 你可以再试试 |
|
|
|
|
|
|
|
|
|
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
NVMe高速传输之摆脱XDMA设计50:主要功能测试结果与分析2 nvmePCIe高速存储
252 浏览 0 评论
NVMe高速传输之摆脱XDMA设计49:主要功能测试结果与分析1
1501 浏览 0 评论
907 浏览 0 评论
855 浏览 0 评论
658 浏览 0 评论
4425 浏览 63 评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-2 02:15 , Processed in 0.654560 second(s), Total 75, Slave 57 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
5467