武汉理工大学《通信原理》课程设计说明书
--移存器程序
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity yicunqi is
port(di,clk:in std_logic;
q6,q5,q4,q3,q2,q1,q0:out std_logic);
end yicunqi;
architecture a of yicunqi is
signal tmp:std_logic_vector(6 downto 0);
begin
process(clk)
begin
if(clk'event and clk='1')then
tmp(6)<=di;
for i in 1to 6 loop
tmp(6-i)<=tmp(7-i);
end loop;
end if;
end process;
q6<=tmp(6);
q5<=tmp(5);
q4<=tmp(4);
q3<=not tmp(3);
q2<=not tmp(2);
q1<=tmp(1);
q0<=not tmp(0);
end a;
移存器电路原理图
--译码器程序
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity yimaqi is
port(a,b,c,d,e,f,g:in std_logic;
selt:out std_logic_vector(2 downto 0));
end yimaqi;
architecture guo of yimaqi is
signal sel:std_logic_vector(6 downto 0);
begin
武汉理工大学《通信原理》课程设计说明书
selt<=a&b&c&d&e&f&g;
process(sel)
begin
case selt is
when"0111111"=>selt<="110";
when"1011111"=>selt<="110";
when"1101111"=>selt<="110";
when"1110111"=>selt<="110";
when"1111011"=>selt<="110";
when"1111101"=>selt<="110";
when"1111110"=>selt<="110";
when"1111111"=>selt<="111";
when others=>selt<="000";
end case;
end process;
end guo;
译码器原理电路图
--判决器程序
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity panjue is
port(a:in std_logic_vector(2 downto 0);
b:in std_logic_vector(2 downto 0);
c:buffer std_logic);
end panjue;
architecture guo of panjue is
begin
c<='1' when a>=b else '0';
end guo;
判决器电路原理图
武汉理工大学《通信原理》课程设计说明书
识别器仿真结果
--分频器程序
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity fenpinqi32 is
port(clk,en:in std_logic;
output:out std_logic);
end fenpinqi32;
architecture behav of fenpinqi32 is
begin
process(clk)
variable sum:std_logic_vector(4 downto 0);
begin
if rising_edge(clk) then
if en='1' then
sum:="00000";
else
sum:=sum+'1';
if sum=31 then
sum:="00000";
output<='1' after 10 ns;
else
output<='0';
end if;
end if;
end if;
end process;
end behav;
分频器电路原理图
武汉理工大学《通信原理》课程设计说明书
波形图
自动门限电路
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity xuanzeqi is
--门限电路程序
port(c1:in boolean;
qout:out std_logic_vector(2 downto 0));
end xuanzeqi;
architecture guo of xuanzeqi is
begin
process(c1)
begin
if c1 then qout<="110";
else qout<="111";
end if;
end process;
end guo;
波形图
时钟控制电路
library ieee;
use ieee.std_logic_1164.all;
--状态触发器程序
武汉理工大学《通信原理》课程设计说明书
use ieee.std_logic_unsigned.all;
entity clkcontr is
port(clk:in std_logic;
q:out std_logic);
end clkcontr;
architecture guo of clkcontr is
begin
process(clk)
begin
if(clk'event and clk='1') then
q<='1';
end if;
end process;
end guo;
时钟控制器原理电路图
波形图
--RS 触发器程序
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity rs_clk is
port(s,r,res:std_logic;
q,not_q:out std_logic);
end rs_clk;
architecture behav of rs_clk is
signal sel1,sel2:std_logic;
begin
process(res,sel1,sel2)
begin
if res='0' then sel1<='0';
sel2<='1';
elsif(S='1' and R='0') then sel1<='1';
sel2<='0';
elsif(S='0' and R='1') then sel1<='0';
elsif(S='0' and R='0') then sel1<=sel1;
sel2<='1';
武汉理工大学《通信原理》课程设计说明书
sel2<=sel2;
end if;
Q<=sel1;
not_Q<=sel2;
end process;
end behav;
RS 触发器电路原理图
波形图