通信人家园

 找回密码
 注册

只需一步,快速开始

短信验证,便捷登录

搜索

军衔等级:

  一级军士长

注册:2008-10-28
跳转到指定楼层
1#
发表于 2009-6-4 10:59:55 |只看该作者 |正序浏览
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_signed.all;
---- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity qianga is
port(esa,esb,esc,esd:in bit;
   rst:in std_logic;
   lta,ltb,ltc,ltdut bit);
end qianga;
architecture Behavioral of qianga is
signal data1:bit_vector(3 downto 0);

begin
process(rst,data1,esa,esb,esc,esd)
   begin
      if rst='0'
    then lta<='0';ltb<='0';ltc<='0';ltd<='0';
    else
      data1(3)<=esa;
    data1(2)<=esb;
    data1(1)<=esc;
    data1(0)<=esd;
    end if;
      case data1 is
    when "0001"=>lta<='1';ltb<='0';ltc<='0';ltd<='0';
    when "0010"=>lta<='0';ltb<='1';ltc<='0';ltd<='0';
    when "0100"=>lta<='0';ltb<='0';ltc<='1';ltd<='0';
    when "1000"=>lta<='0';ltb<='0';ltc<='0';ltd<='1';
    when others=>lta<='0';ltb<='0';ltc<='0';ltd<='0';
    end case;
end process;
end Behavioral;
有个电子技术实验让做个抢答器,昨天看了一天,刚刚编了一个,语法没错了,不知道能不能实现呢,4位抢答,各位帮忙看看哈,我也是学通信的啊,不知道为啥有这个实验

举报本楼

本帖有 7 个回帖,您需要登录后才能浏览 登录 | 注册
您需要登录后才可以回帖 登录 | 注册 |

手机版|C114 ( 沪ICP备12002291号-1 )|联系我们 |网站地图  

GMT+8, 2024-11-15 23:21 , Processed in 0.107825 second(s), 15 queries , Gzip On.

Copyright © 1999-2023 C114 All Rights Reserved

Discuz Licensed

回顶部