library ieee;
use entity mywork is
port(cl,clk0:in std_logic;
out1:out std_logic);
end mywork;
architecture rtl of mywork is
signal q:std_logic;
beginprocess(clk0)
beginif (clk0'event and clk0='1') then
q <=not(cl or q);
end if;
end process;
out1 <=not q;
end rtl;
library ieee;
use entity mywork is
port(a,b,c,d:in std_logic;
y:out std_logic);
end mywork;
architecture rtl of mywork is
signal tmp1,tmp2,t***:std_logic;
begintmp1 <=a or b;
tmp2 <=c or d;
t*** <=tmp1 xor tmp2;
y <=a when tmp1='1' else
t***;end rtl;
library ieee;
use entity mywork is
port(d1,d2,clk:in std_logic;
q:out std_logic);
end mywork;
architecture rtl of mywork is
signal tmp1:std_logic;
begintmp1 <=clk when d1='1' else
d2;process(clk,tmp1)
beginif (clk='1') then
q <=tmp1;
end if;
end process;
end rtl;
library ieee;
use entity mywork is
port(reset,en,d,set,clk:in std_logic;
q:out std_logic);
end mywork;
architecture rtl of mywork is
signal tmp1:std_logic;
begintmp1 <=set and not reset);
process(clk,reset,tmp1)
beginif (reset = 1' )then
q <=0';
elsif (tmp1 = 1') then
q <=1';
elsif (clk'event and clk='1') then
if (en = 1' )then
q <=d;
end if;
end if;
end process;
end rtl;
library ieee;
use entity mywork is
port(d,en,clk,rst:in std_logic;
q1,q:out std_logic);
end mywork;
architecture rtl of mywork is
signal tmp1:std_logic;
beginq1 <=not (d and en) or rst;
process(clk,rst)
beginif (rst = 0' )then
q <=0';
elsif (clk'event and clk='1') then
if (en = 1') then
q <=d;
end if;
end if;
end process;
end rtl;
library ieee;
use entity mywork is
port(d,clk,rst:in std_logic;
dout,q:out std_logic);
end mywork;
architecture rtl of mywork is
signal tmp1,tmp2:std_logic;
begintmp1 <=0' when rst = 1' else
d;tmp2 <=d xor tmp1;
process(clk)
beginif (clk'event and clk='1') then
q <=tmp1;
end if;
end process;
process(clk)
beginif (clk'event and clk='1') then
dout <=tmp2;
end if;
end process;
end rtl;
library ieee;
use entity mywork is
port(reset,en,d,set,clk:in std_logic;
q:out std_logic);
end mywork;
architecture rtl of mywork is
signal tmp1:std_logic;
begintmp1 <=set and not reset);
process(clk)
beginif (clk'event and clk='1') then
if (reset = 1' )then
q <=0';
elsif (tmp1 = 1') then
q <=1';
elsif (en = 1' )then
q <=d;
end if;
end if;
end process;
end rtl;
3、试用vhdl语言编写一个描述非同步复位的十一进制计数器,其实体名为cnt11,输入为reset,clk;输出为q(3 downto 0)。
library ieee;
use use
entity cnt11 is
port(reset,clk:in std_logic;
q:out std_logic_vector(3 downto 0));
end cnt11;
architecture rtl of cnt11 is
signal qs:std_logic_vector(3 downto 0);
beginprocess(reset,clk)
beginif (reset = 1') then
qs <=0000";
elsif (clk'event and clk = 1') then
if (qs<"1010") then
qs <=qs +1;
elseqs <=0000";
end if;
end if;
q <=qs;
end process;
end architecture rtl;
有两盏灯交替闪烁,其中一盏灯亮5秒,灭10秒,而另一盏灯灭5秒,亮10秒,,假设输入为1秒的时钟信号,高电平为亮,低电平为灭,试用vhdl语言实现此电路的控制。
library ieee;
use entity leddisp is
port (clk1s,reset :in std_logic;
led1,led2:out std_logic);
end leddisp;
architecture rtl of leddisp is
beginprocess(clk1s,reset)
variable count:integer range 0 to 15;
beginif (reset=’1’) then
led1_tmp=’1’;
elsif (clk1s’event and clk1s=’1’) then
if (count =14) then
led1_tmp <=not led1_tmp;
count :=0;
elsif (count=4) then
led1_tmp <=not led1_tmp;
count :=count +1;
elsecount :=count +1;
end if;
end if;
led1 <=led1_tmp;
led2 <=not led1_tmp;
end processs;
end rtl;
已知存在一位全加器的实体,其实体名为add1,端口说明为port(a,b,cin: in std_logic; c0, s:out std_logic)。
试用vhdl语言的结构化描述方法(即用component语句)编写一个两位全加器,输入为cin,a0,b0,a1,b1;输出为s0,s1 ,c3。
library ieee;
use entity adder2 is
port(cin,a0,b0,a1,b1: in std_logic;
s0,s1,c3: out std_logic);
end adder2;
architecture structure of adder4 is
component add1
port(a,b,cin: in std_logic;
s,c0:out std_logic);
end component;
signal c0_s:std_logic;
beginu0:add1 port map(a0,b0,cin,s0,c0_s);
u1:add1 port map(a1,b1,c0_s,s1,c3);
end structure;
实现一个序列检测器电路,输入是一个串行位流,当出现序列“111”时,输出为‘1’。这里必须考虑出现长连‘1’的问题。即如果出现…0111110…,则输出就要保持连续3个时钟周期的‘1’。
作业题答案
一 填空题。1.函数pi的功能是根据以下近似公式求 值 请将下面函数的空白处填写正确,以完成求 的功能。include using namespace std include double pi long n double s 0.0 long k for k 1 k n k s s 1.0 k k...
作业题答案
第一次 1 3章 作业 1 如何认识和正确处理资本主义两类不同性质的基本矛盾?对我国改革有何意义?资本主义的基本矛盾是生产资料的私人占有同社会化大生产的矛盾。但其发展也是不平衡的,在不同阶段 不同领域,矛盾的性质也不同。在垄断阶段或垄断领域,其矛盾是私有垄断与其社会化大生产的矛盾,垄断阻碍发展,其矛...
作业题答案
2011 2012 1 5 ip 在eda技术的应用和发展中的意义是什么?答 ip是知识产权或知识产权模块的意思,在eda技术开发中具有十分重要的地位。它是用于asic或fpga中预先设计好的功能模块。当前ip核是为了易于重用而按嵌入式应用专门设计的。ip核按照 四最 目标进行优化的 芯片面积最小,...