[{"createTime":1735734952000,"id":1,"img":"hwy_ms_500_252.jpeg","link":"https://activity.huaweicloud.com/cps.html?fromacct=261f35b6-af54-4511-a2ca-910fa15905d1&utm_source=V1g3MDY4NTY=&utm_medium=cps&utm_campaign=201905","name":"华为云秒杀","status":9,"txt":"华为云38元秒杀","type":1,"updateTime":1735747411000,"userId":3},{"createTime":1736173885000,"id":2,"img":"txy_480_300.png","link":"https://cloud.tencent.com/act/cps/redirect?redirect=1077&cps_key=edb15096bfff75effaaa8c8bb66138bd&from=console","name":"腾讯云秒杀","status":9,"txt":"腾讯云限量秒杀","type":1,"updateTime":1736173885000,"userId":3},{"createTime":1736177492000,"id":3,"img":"aly_251_140.png","link":"https://www.aliyun.com/minisite/goods?userCode=pwp8kmv3","memo":"","name":"阿里云","status":9,"txt":"阿里云2折起","type":1,"updateTime":1736177492000,"userId":3},{"createTime":1735660800000,"id":4,"img":"vultr_560_300.png","link":"https://www.vultr.com/?ref=9603742-8H","name":"Vultr","status":9,"txt":"Vultr送$100","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":5,"img":"jdy_663_320.jpg","link":"https://3.cn/2ay1-e5t","name":"京东云","status":9,"txt":"京东云特惠专区","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":6,"img":"new_ads.png","link":"https://www.iodraw.com/ads","name":"发布广告","status":9,"txt":"发布广告","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":7,"img":"yun_910_50.png","link":"https://activity.huaweicloud.com/discount_area_v5/index.html?fromacct=261f35b6-af54-4511-a2ca-910fa15905d1&utm_source=aXhpYW95YW5nOA===&utm_medium=cps&utm_campaign=201905","name":"底部","status":9,"txt":"高性能云服务器2折起","type":2,"updateTime":1735660800000,"userId":3}]
<>VHDL编写二位数值比较器
二位数值比较器是由四个输入端和三个输出端组成的比较器,实现两个二位二进制数大小的比较(用高低电平来表示输入输出)真值表如下:
(xx表任意状态)
因此设计时,定义4个输入端和3个输出端的实体,分别为A1A0,B1B0和f1(a>b)f2(a<b)f3(a=b)
具体代码如下:
LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; ENTITY homework2 IS PORT(A1:IN
STD_LOGIC; --定义4个输入端和3个输出端 A0:IN STD_LOGIC; B1:IN STD_LOGIC; B0:IN STD_LOGIC;
f1:OUT STD_LOGIC; f2:OUT STD_LOGIC; f3:OUT STD_LOGIC); END homework2;
ARCHITECTURE HA OF homework2 IS SIGNAL tmp:STD_LOGIC_VECTOR(3 DOWNTO
0);--定义一个信号数组 BEGIN tmp<=A1 & B1 & A0 & B0; --用&连接四个输入值,并赋值给tmp PROCESS(tmp)
BEGIN CASE tmp IS --CASE语句实现具体代码 WHEN "0000" =>f1<='0';f2<='0';f3<='1'; WHEN
"0001" =>f1<='0';f2<='1';f3<='0'; WHEN "0010" =>f1<='1';f2<='0';f3<='0'; WHEN
"0011" =>f1<='0';f2<='0';f3<='1'; WHEN "0100" =>f1<='0';f2<='1';f3<='0'; WHEN
"0101" =>f1<='0';f2<='1';f3<='0'; WHEN "0110" =>f1<='0';f2<='1';f3<='0'; WHEN
"0111" =>f1<='0';f2<='1';f3<='0'; WHEN "1000" =>f1<='1';f2<='0';f3<='0'; WHEN
"1001" =>f1<='1';f2<='0';f3<='0'; WHEN "1010" =>f1<='1';f2<='0';f3<='0'; WHEN
"1011" =>f1<='1';f2<='0';f3<='0'; WHEN "1100" =>f1<='0';f2<='0';f3<='1'; WHEN
"1101" =>f1<='0';f2<='1';f3<='0'; WHEN "1110" =>f1<='1';f2<='0';f3<='0'; WHEN
"1111" =>f1<='0';f2<='0';f3<='1'; END CASE; END PROCESS; END HA;
仿真结果如下: