2782
- 收藏
- 点赞
- 分享
- 举报
波形发生器
SWOUT 和LED的低6 位 按高到低输出不同频率的方波,间隔一倍
LED 的第8位为左按钮按下指示,防抖动
LED 的第7位为右按钮按下指示,防抖动
SWOUT 的第8位为左按钮按下时输出至少10 个脉冲
SWOUT 的第7位为左按钮按下一次时输出30 个脉冲
library IEEE;
use IEEE.std_logic_1164.all;
--The IEEE standard 1164 package, declares std_logic, rising_edge(), etc.
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;
use IEEE.std_logic_unsigned.all;
--This package is a version of the Synopsys package and has been
-- optimized for use with the Express compiler.
library SYNOPSYS;
use SYNOPSYS.attributes.all;
entity PULSE2 is
port (
CLKR: in STD_LOGIC;
CLKL: in STD_LOGIC;
LED:out STD_LOGIC_VECTOR(7 DOWNTO 0);
SWOUT:out STD_LOGIC_VECTOR(7 DOWNTO 0)
);
end PULSE2;
architecture PULSE2_arch of PULSE2 is
component OS
port (OSout:out std_logic);
end component ;
SIGNAL COUNT2,COUNT3,COUNT4,COUNT5,COUNT6,COUNT7:STD_LOGIC_VECTOR(3 DOWNTO 0);
SIGNAL COUNTER7:STD_LOGIC_VECTOR(7 DOWNTO 0);
SIGNAL COUNTER6:STD_LOGIC_VECTOR(5 DOWNTO 0);
SIGNAL COUNTT,COUNT1,COUNTR:STD_LOGIC_VECTOR(4 DOWNTO 0);
SIGNAL CLK1,CLK2,CLK3,CLK4,CLK5,CLK6,CLK7,FLAG,FLAGR,OUTL,OUTR:STD_LOGIC;
begin
-- <>
U1:OS PORT MAP(CLK7);
P9:PROCESS(CLK7,COUNT3)
BEGIN
IF(CLK7='1' AND CLK7'EVENT)THEN
COUNT3<=COUNT3+1;
END IF;
END PROCESS;
CLK6<=COUNT3(3);
P8:PROCESS(CLK6,COUNT4)
BEGIN
IF(CLK6='1' AND CLK6'EVENT)THEN
COUNT4<=COUNT4+1;
END IF;
END PROCESS;
CLK5<=COUNT4(3);
P0:PROCESS(CLK5,COUNT1)
BEGIN
IF(CLK5='1' AND CLK5'EVENT)THEN
COUNT1<=COUNT1+1;
END IF;
END PROCESS;
CLK2<=COUNT1(3);
P1:PROCESS(CLK2,COUNTER7)
BEGIN
IF(CLK2='1' AND CLK2'EVENT)THEN
COUNTER7<=COUNTER7+1;
END IF;
END PROCESS;
CLK3<=COUNTER7(6);
SWOUT(5 DOWNTO 0)<=COUNTER7(5 DOWNTO 0);
CLK4<=COUNTER7(7);
P2:PROCESS(CLK3,COUNTER6)
BEGIN
IF(CLK3='1' AND CLK3'EVENT)THEN
COUNTER6<=COUNTER6+1;
END IF;
END PROCESS;
LED(5 DOWNTO 0)<=NOT COUNTER6;
P4:PROCESS(CLK2,CLKL,CLKR,COUNT5,COUNT6)
BEGIN
IF(CLK2='1' AND CLK2'EVENT)THEN
IF(COUNT5<7)THEN
IF(CLKL='1')THEN
COUNT5<=COUNT5+1;
ELSE
COUNT5<="0000";
END IF;
OUTL<='0';
ELSIF(COUNT5<15)THEN
IF(CLKL='1')THEN
COUNT5<="1000";
ELSE
COUNT5<=COUNT5+1;
END IF;
OUTL<='1';
ELSE
COUNT5<="0000";
OUTL<='0';
END IF;
IF(COUNT6<7)THEN
IF(CLKR='1')THEN
COUNT6<=COUNT6+1;
ELSE
COUNT6<="0000";
END IF;
OUTR<='0';
ELSIF(COUNT6<15)THEN
IF(CLKR='1')THEN
COUNT6<="1000";
ELSE
COUNT6<=COUNT6+1;
END IF;
OUTR<='1';
ELSE
COUNT6<="0000";
OUTR<='1';
END IF;
END IF;
END PROCESS;
LED(6)<=NOT OUTL;
LED(7)<=NOT OUTR;
P12:PROCESS(CLK4,OUTR,COUNTT,COUNTR)
BEGIN
IF(CLK4='1' AND CLK4'EVENT)THEN
IF(COUNTT=0 )THEN
IF(OUTL='1')THEN COUNTT<=COUNTT+1;
ELSE COUNTT<=COUNTT;END IF;
FLAG<='0';
ELSIF(COUNTT<31)THEN
COUNTT<=COUNTT+1;
FLAG<='1';
ELSIF(COUNTT=31)THEN
IF(OUTL='0')THEN
COUNTT<="00000";
ELSE
COUNTT<=COUNTT;
END IF;
FLAG<='0';
END IF;
IF(COUNTR=0 )THEN
IF(OUTR='1')THEN COUNTR<=COUNTR+1;
ELSE COUNTR<=COUNTR;END IF;
FLAGR<='0';
ELSIF(COUNTR<10)THEN
COUNTR<=COUNTR+1;
FLAGR<='1';
ELSE
IF(OUTL='0')THEN
COUNTR<="00000";
ELSE
COUNTR<=COUNTR;
END IF;
END IF;
END IF;
END PROCESS;
SWOUT(6)<=CLK4 AND FLAGR;
SWOUT(7)<=CLK4 AND FLAG;
end PULSE2_arch;
LED 的第8位为左按钮按下指示,防抖动
LED 的第7位为右按钮按下指示,防抖动
SWOUT 的第8位为左按钮按下时输出至少10 个脉冲
SWOUT 的第7位为左按钮按下一次时输出30 个脉冲
library IEEE;
use IEEE.std_logic_1164.all;
--The IEEE standard 1164 package, declares std_logic, rising_edge(), etc.
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;
use IEEE.std_logic_unsigned.all;
--This package is a version of the Synopsys package and has been
-- optimized for use with the Express compiler.
library SYNOPSYS;
use SYNOPSYS.attributes.all;
entity PULSE2 is
port (
CLKR: in STD_LOGIC;
CLKL: in STD_LOGIC;
LED:out STD_LOGIC_VECTOR(7 DOWNTO 0);
SWOUT:out STD_LOGIC_VECTOR(7 DOWNTO 0)
);
end PULSE2;
architecture PULSE2_arch of PULSE2 is
component OS
port (OSout:out std_logic);
end component ;
SIGNAL COUNT2,COUNT3,COUNT4,COUNT5,COUNT6,COUNT7:STD_LOGIC_VECTOR(3 DOWNTO 0);
SIGNAL COUNTER7:STD_LOGIC_VECTOR(7 DOWNTO 0);
SIGNAL COUNTER6:STD_LOGIC_VECTOR(5 DOWNTO 0);
SIGNAL COUNTT,COUNT1,COUNTR:STD_LOGIC_VECTOR(4 DOWNTO 0);
SIGNAL CLK1,CLK2,CLK3,CLK4,CLK5,CLK6,CLK7,FLAG,FLAGR,OUTL,OUTR:STD_LOGIC;
begin
-- <
U1:OS PORT MAP(CLK7);
P9:PROCESS(CLK7,COUNT3)
BEGIN
IF(CLK7='1' AND CLK7'EVENT)THEN
COUNT3<=COUNT3+1;
END IF;
END PROCESS;
CLK6<=COUNT3(3);
P8:PROCESS(CLK6,COUNT4)
BEGIN
IF(CLK6='1' AND CLK6'EVENT)THEN
COUNT4<=COUNT4+1;
END IF;
END PROCESS;
CLK5<=COUNT4(3);
P0:PROCESS(CLK5,COUNT1)
BEGIN
IF(CLK5='1' AND CLK5'EVENT)THEN
COUNT1<=COUNT1+1;
END IF;
END PROCESS;
CLK2<=COUNT1(3);
P1:PROCESS(CLK2,COUNTER7)
BEGIN
IF(CLK2='1' AND CLK2'EVENT)THEN
COUNTER7<=COUNTER7+1;
END IF;
END PROCESS;
CLK3<=COUNTER7(6);
SWOUT(5 DOWNTO 0)<=COUNTER7(5 DOWNTO 0);
CLK4<=COUNTER7(7);
P2:PROCESS(CLK3,COUNTER6)
BEGIN
IF(CLK3='1' AND CLK3'EVENT)THEN
COUNTER6<=COUNTER6+1;
END IF;
END PROCESS;
LED(5 DOWNTO 0)<=NOT COUNTER6;
P4:PROCESS(CLK2,CLKL,CLKR,COUNT5,COUNT6)
BEGIN
IF(CLK2='1' AND CLK2'EVENT)THEN
IF(COUNT5<7)THEN
IF(CLKL='1')THEN
COUNT5<=COUNT5+1;
ELSE
COUNT5<="0000";
END IF;
OUTL<='0';
ELSIF(COUNT5<15)THEN
IF(CLKL='1')THEN
COUNT5<="1000";
ELSE
COUNT5<=COUNT5+1;
END IF;
OUTL<='1';
ELSE
COUNT5<="0000";
OUTL<='0';
END IF;
IF(COUNT6<7)THEN
IF(CLKR='1')THEN
COUNT6<=COUNT6+1;
ELSE
COUNT6<="0000";
END IF;
OUTR<='0';
ELSIF(COUNT6<15)THEN
IF(CLKR='1')THEN
COUNT6<="1000";
ELSE
COUNT6<=COUNT6+1;
END IF;
OUTR<='1';
ELSE
COUNT6<="0000";
OUTR<='1';
END IF;
END IF;
END PROCESS;
LED(6)<=NOT OUTL;
LED(7)<=NOT OUTR;
P12:PROCESS(CLK4,OUTR,COUNTT,COUNTR)
BEGIN
IF(CLK4='1' AND CLK4'EVENT)THEN
IF(COUNTT=0 )THEN
IF(OUTL='1')THEN COUNTT<=COUNTT+1;
ELSE COUNTT<=COUNTT;END IF;
FLAG<='0';
ELSIF(COUNTT<31)THEN
COUNTT<=COUNTT+1;
FLAG<='1';
ELSIF(COUNTT=31)THEN
IF(OUTL='0')THEN
COUNTT<="00000";
ELSE
COUNTT<=COUNTT;
END IF;
FLAG<='0';
END IF;
IF(COUNTR=0 )THEN
IF(OUTR='1')THEN COUNTR<=COUNTR+1;
ELSE COUNTR<=COUNTR;END IF;
FLAGR<='0';
ELSIF(COUNTR<10)THEN
COUNTR<=COUNTR+1;
FLAGR<='1';
ELSE
IF(OUTL='0')THEN
COUNTR<="00000";
ELSE
COUNTR<=COUNTR;
END IF;
END IF;
END IF;
END PROCESS;
SWOUT(6)<=CLK4 AND FLAGR;
SWOUT(7)<=CLK4 AND FLAG;
end PULSE2_arch;
我来回答
回答0个
时间排序
认可量排序
暂无数据
或将文件直接拖到这里
悬赏:
E币
网盘
* 网盘链接:
* 提取码:
悬赏:
E币
Markdown 语法
- 加粗**内容**
- 斜体*内容*
- 删除线~~内容~~
- 引用> 引用内容
- 代码`代码`
- 代码块```编程语言↵代码```
- 链接[链接标题](url)
- 无序列表- 内容
- 有序列表1. 内容
- 缩进内容
- 图片![alt](url)
相关问答
-
2008-10-02 20:40:04
-
2020-09-25 14:30:30
-
12018-12-05 16:02:25
-
2020-09-25 14:17:45
-
2008-11-25 08:34:25
-
2009-06-15 10:22:42
-
2017-02-24 16:49:40
-
2018-12-06 10:37:26
-
2008-10-02 20:20:48
-
2012-12-24 15:37:03
-
2018-12-25 09:41:57
-
2015-07-29 13:29:29
-
2016-11-14 17:08:42
-
2022-10-17 16:05:15
-
2018-11-02 13:32:51
-
2018-12-12 14:14:07
-
2019-01-17 16:22:20
-
2020-11-09 17:23:06
-
2023-06-01 14:50:38
无更多相似问答 去提问
点击登录
-- 积分
-- E币
提问
—
收益
—
被采纳
—
我要提问
切换马甲
上一页
下一页
悬赏问答
-
5Hi3516CV610 如何使用SD卡升级固件
-
5cat /dev/logmpp 报错 <3>[ vi] [func]:vi_send_frame_node [line]:99 [info]:vi pic queue is full!
-
50如何获取vpss chn的图像修改后发送至vo
-
5FPGA通过Bt1120传YUV422数据过来,vi接收不到数据——3516dv500
-
50SS928 运行PQtools 拼接 推到设备里有一半画面会异常
-
53536AV100的sample_vdec输出到CVBS显示
-
10海思板子mpp怎么在vi阶段改变视频数据尺寸
-
10HI3559AV100 多摄像头同步模式
-
9海思ss928单路摄像头vio中加入opencv处理并显示
-
10EB-RV1126-BC-191板子运行自己编码的程序
举报反馈
举报类型
- 内容涉黄/赌/毒
- 内容侵权/抄袭
- 政治相关
- 涉嫌广告
- 侮辱谩骂
- 其他
详细说明
提醒
你的问题还没有最佳答案,是否结题,结题后将扣除20%的悬赏金
取消
确认
提醒
你的问题还没有最佳答案,是否结题,结题后将根据回答情况扣除相应悬赏金(1回答=1E币)
取消
确认