返回首页

基于vhdl语言的8位数字频率计的设计?

170 2023-09-21 11:13 admin

一、基于vhdl语言的8位数字频率计的设计?

实验目的: 设计一个4位十进制频率计,学习复杂数字系统的设计方法。实验原理:根据频率的定义和频率测量的基本原理,测定信号的频率必须有一个脉宽为1秒的脉冲计数允许信号,1秒计数结束后,计数值(即所测信号频率)锁入锁存器,并为下一次测频作准备,即将计数器清零。试验内容:1、根据频率计的工作原理,将电路划分成控制器、计数器、锁存器和LED显示几个模块, 控制器――产生1秒脉宽的计数允许信号、锁存信号和计数器清零信号计数器――对输入信号的脉冲数进行累计锁存器――锁存测得的频率值LED显示――将频率值显示在数码管上顶层文件框图如下: 2、用元件例化语句写出频率计的顶层文件。提示:十进制计数器输出的应是4位十进制数的BCD码,因此输出一共是4×4bit。实验结果:各模块电路的VHDL描述:10进制计数器library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity cnt10 is port (rst,fx,ena:in std_logic; cout: out std_logic; outy :out std_logic_vector(3 downto 0));end cnt10;architecture behv of cnt10 isbegin process (rst,ena,fx) variable cqi :std_logic_vector(3 downto 0);begin if rst='1' then cqi :=(others =>'0'); elsif fx'event and fx='1' then if ena ='1' then if cqi < 9 then cqi:=cqi+1;cout<='0'; elsif cqi=9 then cqi :=(others =>'0'); cout<='1'; end if; elsif ena='0' then cqi:=(others =>'0'); end if;end if; outy <=cqi;end process;end behv;4位10进计数器library ieee;use ieee.std_logic_1164.all;entity cnt10_4 isport(fx,rst,ena:in std_logic; d:out std_logic_vector(15 downto 0));end entity;architecture one of cnt10_4 iscomponent cnt10 port (rst,fx,ena:in std_logic; cout: out std_logic; outy :out std_logic_vector(3 downto 0));end component;signal e:std_logic_vector(3 downto 0);beginu1:cnt10 port map(fx=>fx,rst=>rst,ena=>ena,cout=>e(0),outy=>d(3 downto 0));u2:cnt10 port map(fx=>e(0),rst=>rst,ena=>ena,cout=>e(1),outy=>d(7 downto 4));u3:cnt10 port map(fx=>e(1),rst=>rst,ena=>ena,cout=>e(2),outy=>d(11 downto 8));u4:cnt10 port map(fx=>e(2),rst=>rst,ena=>ena,cout=>e(3),outy=>d(15 downto 12));end architecture one;16位锁存器library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity latch4 isport(d:in std_logic_vector(15 downto 0);ena,clk:in std_logic;q:out std_logic_vector(15 downto 0));end latch4;architecture one of latch4 isbeginprocess(clk,ena,d)variable cqi:std_logic_vector(15 downto 0);beginif ena='0' then cqi:=cqi;elsif clk'event and clk='1' then cqi:=d;end if;q<=cqi;end process;end one;LED控制模块library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity led_controller isport(d:in std_logic_vector(3 downto 0);a:out std_logic_vector(6 downto 0));end led_controller;architecture one of led_controller isbegin process(d)begincase d iswhen "0000"=> a<="0111111";when "0001"=> a<="0000110";when "0010"=> a<="1011011";when "0011"=> a<="1001111";when "0100"=> a<="1100110";when "0101"=> a<="1101101";when "0110"=> a<="1111101";when "0111"=> a<="0000111";when "1000"=> a<="1111111";when "1001"=> a<="1101111";when "1010"=> a<="1110111";when "1011"=> a<="1111100";when "1100"=> a<="0111001";when "1101"=> a<="1011110";when "1110"=> a<="1111001";when "1111"=> a<="1110001";when others=> null;end case;end process;end;控制模块library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity control is port (clk:in std_logic; rst,ena: out std_logic);end control;architecture behv of control isbegin process (clk) variable cqi :std_logic_vector(2 downto 0);begin if clk'event and clk='1' then if cqi <1 then cqi:=cqi+1;ena<='1';rst<='0'; elsif cqi=1 then cqi :=(others =>'0'); ena<='0';rst<='1'; end if; end if; end process;end behv;总体例化语句:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity cntf isport(rset,clk:in std_logic; fx:in std_logic; ledout:out std_logic_vector(27 downto 0));end entity;architecture one of cntf iscomponent control port (clk:in std_logic; rst,ena: out std_logic);end component;component cnt10_4port(fx,rst,ena:in std_logic; d:out std_logic_vector(15 downto 0));end component;component latch4port(d:in std_logic_vector(15 downto 0);ena,clk:in std_logic;q:out std_logic_vector(15 downto 0));end component;component led_controllerport(d:in std_logic_vector(3 downto 0);a:out std_logic_vector(6 downto 0));end component;signal x,z:std_logic;signal g,h:std_logic_vector(15 downto 0);signal leds:std_logic_vector(27 downto 0);beginu1: control port map(clk=>clk,ena=>x,rst=>z);u2: cnt10_4 port map(fx=>fx,rst=>z,ena=>x,d=>g);u3: latch4 port map(clk=>clk,ena=>x,d=>g,q=>h);u4: led_controller port map(d(3 downto 0)=>h(3 downto 0),a(6 downto 0)=>leds(6 downto 0));u5: led_controller port map(d(3 downto 0)=>h(7 downto 4),a(6 downto 0)=>leds(13 downto 7));u6: led_controller port map(d(3 downto 0)=>h(11 downto 8),a(6 downto 0)=>leds(20 downto 14));u7: led_controller port map(d(3 downto 0)=>h(15 downto 12),a(6 downto 0)=>leds(27 downto 21));ledout<=leds;end; 这是我当时做的一个4位频率计,CLK为一个1HZ的时钟信号。可用数码管显示出频率数的。只要你能读懂原理,是很容易改成八位的。 如果要图文混合设计,即各模块设计好后,顶层文件用原理图设计即可。给你参考一下吧。

二、verilog与vhdl的区别?

1 verilog和vhdl都是硬件描述语言,用于描述数字电路的行为和结构。

2 verilog语言更加简洁,语法类似C语言,适合描述数字电路的结构和行为,而vhdl语言更加严谨,适合描述数字系统的结构和行为。

3 此外,verilog更加流行,应用范围更广,但vhdl的代码可读性更强,更适合大型设计项目。因此,verilog和vhdl的区别在于语法结构、适用领域和代码可读性等方面。

三、vhdl中bit的取值?

std库的standard包集:定义了位(BIT)、布尔(Boolean)、整数(integer)和实数(real)数据类型。

四、vhdl描述进程的语?

VHDL语言的主要描述语句 按照语句的执行顺序对VHDL语言进行分类,包含两类语句:

 并行描述语句 该语句的执行与书写顺序无关,总是同时被执行  顺序描述语句 从仿真的角度,该语句是顺序执行的 进程语句(PROCESS)是最典型的并行语句,一个构造体内可以有几个进程语句同时存在,而且并发执行。但是进程内部的所有语句都是顺序语句。

五、vhdl和verilog的区别?

vhdl与verilog的区别为:用途不同、编程层次不同。

vhdl主要用于描述数字系统的结构、行为、功能和接口。verilog以文本形式来描述数字系统硬件,可以表示逻辑电路图、逻辑表达式,还可以表示数字逻辑系统所完成的逻辑功能。 

六、电子密码锁原理?

电子密码锁的原理是利用电路控制机械结构实现开锁或锁定的功能。用户在输入正确的密码后,电路会识别密码并输出正确的信号,控制机械结构使得锁可以打开或关闭。电子密码锁中通常包含多个部件,如数字显示屏、输入键盘、控制电路、电磁铁等。当用户输入密码时,密码会通过输入键盘被输入到控制电路中,控制电路会对比输入的密码和预设的密码,如果两者一致,那么控制电路会输出信号控制电磁铁打开锁扣,使得锁可以被打开。电子密码锁相比于传统机械锁更安全、更便捷、更高效,被广泛应用于办公室、家庭、酒店等多个领域。

七、电子密码锁的优缺点?

电子密码锁的优点有:

1、保密性好。编码量多,远远大于弹子锁。随机开锁成功率几乎为零。

2、密码可变。用户可以经常更改密码,防止密码被盗,同时也可以避免因人员的更替而使锁的密级下降。

3、误码输入保护。当输入密码多次错误时,报警系统自动启动。

4.、电子密码锁操作简单易行,一学即会。

5、干扰码功能:在输入正确密码前可输入任意码。

6、安保功能:如果连续输错4次密码将会自动断电3分钟。

缺点,一是复杂化,因为锁具本身是一种机械卡阻机构,最终还要靠机械动作来完成。而电子锁必须完成机械动作(操作)—电子转换和电子控制—机械执行这一系列过程。显然是复杂一些。二是故障概率相对较高,电子器件一多,一复杂化。

八、电子商务就是基于什么产生的交易模式?

  电子商务是指以信息网络技术为手段,以商品交换为中心的商务活动;也可理解为在互联网、企业内部网和增值网上以电子交易方式进行交易活动和相关服务的活动,是传统商业活动各环节的电子化、网络化、信息化。  由此可见,电子商务就是基于开展商务活动所使用的信息网络技术手段和方式方法,或者理解为基于互联网、企业内部网和增值网上采用的电子交易方式和手段;包括:基于浏览器/服务器应用方式,实现消费者的网上购物的交易平台,商户之间的网上交易和在线交易的电子支付系统,以及各种商务活动、交易活动、金融活动和相关的综合服务活动的一种新型的商业运营模式等等。

九、租房电子密码锁打不开了怎么办?

电子密码锁打不开,不知道哪种情况:1、缺电:一般外接充电宝可以解决,打开后更换电池;2、忘记密码:可以让房东用管理应急钥匙来打开,然后更换密码;3、锁坏:找专业维修人员;打不开的原因可能分析下:1、电量是否充足或电池质量问题:电量不充足会导致锁具有时可以有事又不可以开启;2、密码锁长期使用造成主板损耗过大:从而造成电池漏电,无法开启锁具;3、电机无法运作:普通消费者怎么看是否电机损坏,很简单,只要我们输入一种开启方式能听到锁具内”吱“的一声,说明电机没有损坏,无法听到则说明电机已坏,需要更换;4、主板损坏会造成电池消耗过大:密码与卡片无法开启(黑屏);5、密码锁体损坏:我们在更换智能锁时尽量更换加重加厚材料,特别是锁体内部材料厚度;6、防盗门下沉或天地钩脱落:如是下沉只需把门套上孔位往下扩大就可以解决;如是天地钩脱落,须请专业人士处理;这里也简单介绍一下,如想治本必须在锁体沟的位置转一个小孔,挂上天地钩后用一根钢丝穿过去固定,防止天地钩脱落;7。

希望能够对您有一定帮助!

十、电子密码锁安全吗?

电子密码锁还是很安全的,但世事无绝对,金库也有被盗的,别说一般的家庭用门锁。