请帮我注释这个VHDL程序

小程序,流水灯的,每一行都要注释。注释得好的话给到100分。libraryieee;useieee.std_logic_1164.all;entitymylightisp... 小程序,流水灯的,每一行都要注释。注释得好的话给到100分。

library ieee ;
use ieee.std_logic_1164.all;

entity mylight is
port (start : in std_logic;
stop : in std_logic;
clk:in std_logic;
shift_left : in std_logic;
Q : out std_logic_vector(7 downto 0)

);
end mylight;

architecture behavior of mylight is

signal lights : std_logic_vector(7 downto 0);
begin
process(clk, start, stop, shift_left)
begin
if (start = '0' or stop = '1') then lights <= (others => '1');
elsif (clk'event and clk = '1') then
if (shift_left = '1') then
lights <= lights(6 downto 0) & '0';
else
lights <= '0' & lights(7 downto 1);
end if;
end if;
end process;

Q <= lights;

end behavior;
展开
 我来答
百度网友d5dfec7
2008-05-24 · TA获得超过104个赞
知道答主
回答量:65
采纳率:0%
帮助的人:46.7万
展开全部
ibrary ieee ; ///库头文件,每个VHDL程序都要加的
use ieee.std_logic_1164.all; /////用了标准逻辑的IEEE第1164号文件,这个文件包括了VHDL中的经常用的许多东西,几乎都要加的

entity mylight is /////定义了实体为 MYLIGHT
port (start : in std_logic; /////定义START为标准的逻辑输入信号
stop : in std_logic; /////定义stop为标准的逻辑输入信号
clk:in std_logic; //////定义clk为标准的逻辑输入信号
shift_left : in std_logic; //////定义shift_left为标准的逻辑输入信号
Q : out std_logic_vector(7 downto 0)
//////定义Q 为7到0的标准的逻辑位矢量
);
end mylight; //////结束实体

architecture behavior of mylight is /////定义了实体的一个结构体为 behavior

signal lights : std_logic_vector(7 downto 0); //////定义signal lights 为7到0的标准的逻辑位矢量
begin /////开始
process(clk, start, stop, shift_left) /////执行过程程序,形式参数为(clk, start, stop, shift_left)
begin /////开始
if (start = '0' or stop = '1') then lights <= (others => '1');
/////如果start = '0'或者stop = '1'成立,则进入后面的语句块执行others => '1'赋值给lights
elsif (clk'event and clk = '1') /////如果上述的条件都不成立则执行CLK作为事件信号置1
then /////然后接着执行下面的程序
if (shift_left = '1') /////如果shift_left = '1'成立
then /////接着执行下面的程序
lights <= lights(6 downto 0) & '0'; /////将位矢量lights(6 downto 0)的值与0相与赋值给lights
else lights <= '0' & lights(7 downto 1); ///// 如果shift_left = '1'不成立,将0'& lights(7 downto 1)值赋给lights
end if; /////结束内IF的条件判断语句
end if; /////结束外IF的条件判断语句
end process; /////结束过程

Q <= lights; /////将lights位矢量的值赋给位矢量Q

end behavior; /////结束 behavior实体

以上只是我在自己专业知识基础上的解答。。有不好的地方请高手指点

祝你好运~~~~~
创作者L4Rkb2rA82
2019-03-10 · TA获得超过4639个赞
知道大有可为答主
回答量:3305
采纳率:24%
帮助的人:175万
展开全部
if(clk'event
and
clk='1')then
--当clk来上升沿脉冲,
if(stop='0')then
--且stop为0时,
chf:=0;
--chf置0,
num:=0;
--num置0,
b:='1';
--b置1,
aa:=0;
--aa置0,
lc:=0;
--lc置0,
elsif(start='0')then
--如果stop为1(clk有上升沿),start为
b:='0';
--0时,b置0,
chf:=700;
--chf置为700,
lc:=0;
--lc置0,
elsif(start='1'
and
js='1'and
pause='1')then
--如果stop为1(clk有上升
if(b='0')then
--沿),start为1,且js为1,pause为1时,
num:=num+1;
--如果b为0,则num自加1,
end
if;
--结束。
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式