Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Автоматизация проектирования радиоэлектронных устройств связи..pdf
Скачиваний:
12
Добавлен:
15.11.2022
Размер:
5.53 Mб
Скачать

2. Описание на языке VHDL счетчика импульсов (до 19) передатчика

library ieee;

use ieee. std_logic__1164 .all; use ieee.std_logic_arith.all;

entity counter is port (

elk, reset: in std__logic;

число тактов 11+7+1=19:

q:out integer range 0 to 18

); end counter/

architecture behaviour of counter is begin

process (elk,reset) variable i: integer;

begin

сброс счетчика

if reset='0' then q <= 18;

i := 18;

elsif rising_edge(elk) then

переполнение: if i=18 then

i:=0; else

i:=i+l;

end if; q <= i;

end if; end process;

end behaviour;

library ieee;

use ieee.std_iogic_1164.all; use ieee.std_logic_arith.all;

entity counter is

 

 

port (

in

std_logic;

elk,reset:

— число тактов

2*n=26:

q:

out

integer range 0 to 2*13-1

) ;

 

 

end counter;

 

 

architecture behaviour of counter is begin

process (elk,reset) variable i: integer;

begin

— сброс счетчика в начальное положение if reset='0' then

q <= 2*13-1; i := 2*13-1;

elsif falling_edge(elk) then

— переполнение: if i=2*13-l then :=0;

else

i:*i+l; end if;

q <= i; end if;

end process; end behaviour;

library ieee;

use ieee.std_logic_1164.all; use ieee.std_logic_arith.all;

entity counter_rx is port (

elk,reset: in std_logic;

— число импульсов 19=11+7+1: q: out integer range 0 to 18

);

end counter_rx;

architecture behaviour of counter_rx is begin

process (elk,reset) variable i: integer;

begin

— сброс

if reset='0' then q <= 18;

i := 18;

elsif falling_edge(elk) then --переполнение:

if i=18 then i :=0 ;

else i:=i+l;

end if; q <= i;

end if; end process;

end behaviour;

library ieee;

 

 

 

 

use

ieee.std_logic__1164 .all;

entity ts_former is

 

port (

 

 

in

std_logic;

 

elk,reset:

 

 

--число

КИ: N=7

std_logic_vector(6 downto 0)

 

q:

 

 

out

end

) ;

 

 

 

 

ts_former;

 

 

 

architecture behaviour of ts_former is

 

signal d: std_logic_vector(6 downto 0);

begin

 

 

 

 

 

q <= d;

(elk,

reset)

 

process

 

begin

reset='0'

then

 

if

 

 

d

<=

"1000000";

 

elsif

falling_edge(elk) then — по заднему фронту

 

 

кольцевой счетчик:

 

 

for i in 1 to 6 loop

 

 

end

d(i) <= d(i-l);

 

 

loop;

 

 

d (0)

<=

d (6);

end if; end process; end behaviour;

library ieee;

use ieee.std_logic_1164.all;

entity ts_former is port (

elk,reset:in std_logic;

— число канальных интервалов: N=10 q:out std_logic_vector(9 downto 0)

) ;

end ts_former;

architecture behaviour of ts_former is signal d: std_logic_vector(9 downto 0) ;

begin

q <= d;

process (elk, reset) begin

if reset='0' then

d <= "1000000000";

elsif falling_edge(elk) then — по заднему фронту

кольцевой счетчик: for i in 1 to 9 loop

d(i) <= d(i-l); end loop;

d (0) <= d (9); end if;

end process; end behaviour;