Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Курсовые / var 23 / САПР_курсач.doc
Скачиваний:
33
Добавлен:
17.04.2013
Размер:
683.52 Кб
Скачать

Задание на курсовой проект.

Вариант 23

Вход

Режим

R

C

ЕС

H

x

x

Q(0) – Cout - B, Q(l) - Q(7) - H

B

H

\

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

B

\

H

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

B

H

x

Код без изменения

B

x

B

Код без изменения

B

H

/

Код без изменения

B

/

H

Код без изменения

Примечание: Схема счётчика-делителя на 8 имеет в основе синхронный счётчик Джонсона (используется 4 триггера), который даёт повышение скорости счёта.

Дешифратор переводит состояния триггера счётчика в восемь выходных, соответствующих счёту от 0 до 7.

Файлы проекта.

Библиотека элементов проекта. (bibl.vhd)

entity INV is

port(x:in bit; y:out bit);

end INV;

architecture behavior_inv of inv is

begin

y <= not x;

end behavior_inv;

entity N2AND is

port(x1,x2:in bit; y:out bit);

end N2AND;

architecture behavior_n2and of n2and is

begin

y <= (not x1) and (not x2);

end behavior_n2and;

entity DCRT is

port(r,d,c: in bit; q,nq: out bit);

end DCRT;

architecture behavior_dcrt of dcrt is

signal stored: bit;

begin

process(R,C,D)

begin

if (R = '1') then

Q <= '0';

nQ <= '1';

elsif (C = '1' and not C'Stable) then

Q <= stored;

nQ <= not stored;

elsif (C = '0') then

stored <= D;

end if;

end process;

end behavior_dcrt;

Библиотека архитектур проекта. (model.vhd)

library bibl;

use bibl.all;

entity REG23 is

port(c,ec,r:in bit;q:out bit_vector(0 to 7);cout:out bit);

end REG23;

architecture STR of REG23 is

component INV

port(x:in bit;y:out bit);

end component;

component N2AND

port(x1,x2:in bit;y:out bit);

end component;

component DCRT

port(r,d,c:in bit;q,nq:out bit);

end component;

signal x,nx:bit_vector(1 to 4);

signal w,b,y,nr:bit;

begin

d1:N2AND port map(c,ec,y);

d2:N2AND port map(x(1),x(3),w);

d3:N2AND port map(nx(2),w,b);

d4:DCRT port map(nr,nx(4),y,x(1),nx(1));

d5:DCRT port map(nr,x(1),y,x(2),nx(2));

d6:DCRT port map(nr,b,y,x(3),nx(3));

d7:DCRT port map(nr,x(3),y,x(4),nx(4));

d8:N2AND port map(x(4),x(1),q(0));

d9:N2AND port map(x(1),nx(2),q(5));

d10:N2AND port map(nx(2),x(3),q(2));

d11:N2AND port map(x(3),nx(4),q(7));

d12:N2AND port map(x(4),nx(3),q(3));

d13:N2AND port map(nx(3),x(2),q(6));

d14:N2AND port map(x(2),nx(1),q(1));

d15:N2AND port map(nx(1),nx(4),q(4));

d16:INV port map(x(4),cout);

d17:INV port map(r,nr);

end STR;

architecture RTL of REG23 is

component DCRT

port(r,d,c:in bit;q,nq:out bit);

end component;

signal x,nx:bit_vector(1 to 4);

signal w,b,y,nr:bit;

begin

d1: y <= ((not c) and (not ec));

d2: w <= (not (x(1)) and not (x(3)));

d3: b <= ( not nx(2) and not w);

d4: DCRT port map(nr,nx(4),y,x(1),nx(1));

d5: DCRT port map(nr,x(1),y,x(2),nx(2));

d6: DCRT port map(nr,b,y,x(3),nx(3));

d7: DCRT port map(nr,x(3),y,x(4),nx(4));

d8: q(0) <= (not x(4)) and (not x(1));

d9: q(5) <= (not x(1)) and (not nx(2));

d10: q(2) <= (not nx(2)) and (not x(3));

d11: q(7) <= (not x(3)) and (not nx(4));

d12: q(3) <= (not x(4)) and (not nx(3));

d13: q(6) <= (not nx(3)) and (not x(2));

d14: q(1) <= (not x(2)) and (not nx(1));

d15: q(4) <= (not nx(1)) and (not nx(4));

d16: cout <= not x(4);

d17: nr <= not r;

end RTL;

architecture ALG of REG23 is

signal x,nx:bit_vector(1 to 4);

signal w,b,y:bit;

begin

process(r,c,ec)

variable J:integer:=0;

begin

If (R = '1') then

if (EC='0' and C='0' and ((not C'Stable) or (not EC'stable))) then

if (J < 3) then

Cout <= '1';

J:=J+1;

elsif (J >= 3) and (J < 7) then

Cout <= '0';

J:=J+1;

elsif (J = 7) then

J:=0;

Cout <= '1';

end if;

end if;

elsif (R = '0') then

J:=0;

Cout <= '1';

end if;

for i in 0 to 7 loop

Q(i):='0';

end loop;

Q(J):='1';

end process;

end ALG;

Соседние файлы в папке var 23