КАТЕГОРИИ: Архитектура-(3434)Астрономия-(809)Биология-(7483)Биотехнологии-(1457)Военное дело-(14632)Высокие технологии-(1363)География-(913)Геология-(1438)Государство-(451)Демография-(1065)Дом-(47672)Журналистика и СМИ-(912)Изобретательство-(14524)Иностранные языки-(4268)Информатика-(17799)Искусство-(1338)История-(13644)Компьютеры-(11121)Косметика-(55)Кулинария-(373)Культура-(8427)Лингвистика-(374)Литература-(1642)Маркетинг-(23702)Математика-(16968)Машиностроение-(1700)Медицина-(12668)Менеджмент-(24684)Механика-(15423)Науковедение-(506)Образование-(11852)Охрана труда-(3308)Педагогика-(5571)Полиграфия-(1312)Политика-(7869)Право-(5454)Приборостроение-(1369)Программирование-(2801)Производство-(97182)Промышленность-(8706)Психология-(18388)Религия-(3217)Связь-(10668)Сельское хозяйство-(299)Социология-(6455)Спорт-(42831)Строительство-(4793)Торговля-(5050)Транспорт-(2929)Туризм-(1568)Физика-(3942)Философия-(17015)Финансы-(26596)Химия-(22929)Экология-(12095)Экономика-(9961)Электроника-(8441)Электротехника-(4623)Энергетика-(12629)Юриспруденция-(1492)Ядерная техника-(1748) |
Розроблення структурного опису пристрою
Код бібліотеки: library ieee; use ieee.std_logic_1164.all; package my_func is
component S1 port(in1: in STD_LOGIC_VECTOR(0 to 5); out1: out STD_LOGIC_VECTOR(0 to 3)); end component;
component S2 port(in2: in STD_LOGIC_VECTOR(0 to 5); out2: out STD_LOGIC_VECTOR(0 to 3)); end component;
component S3 port(in3: in STD_LOGIC_VECTOR(0 to 5); out3: out STD_LOGIC_VECTOR(0 to 3)); end component;
component S4 port(in4: in STD_LOGIC_VECTOR(0 to 5); out4: out STD_LOGIC_VECTOR(0 to 3)); end component;
component S5 port(in5: in STD_LOGIC_VECTOR(0 to 5); out5: out STD_LOGIC_VECTOR(0 to 3)); end component;
component S6 port(in6: in STD_LOGIC_VECTOR(0 to 5); out6: out STD_LOGIC_VECTOR(0 to 3)); end component;
component S7 port(in7: in STD_LOGIC_VECTOR(0 to 5); out7: out STD_LOGIC_VECTOR(0 to 3)); end component;
component S8 port(in8: in STD_LOGIC_VECTOR(0 to 5); out8: out STD_LOGIC_VECTOR(0 to 3)); end component;
end package my_func; --Тіло пакету.
package body my_func is end package body my_func;
library ieee; use ieee.std_logic_1164.all; entity S1 is port(in1: in STD_LOGIC_VECTOR(0 to 5); out1: out STD_LOGIC_VECTOR(0 to 3)); end S1; architecture model_S1 of S1 is begin with in1 select out1(0) <= '1' when "000000"|"000100"|"001010"|"001100"|"001110"|"010010"|"010110"|"011010"| "000011"|"001001"|"001101"|"010001"|"010101"|"010111"|"011001"|"011111"| "100100"|"100110"|"101000"|"101110"|"110000"|"110010"|"110100"|"111010"| "100001"|"100011"|"100101"|"101011"|"110011"|"110111"|"111001"|"111111", '0' when others; with in1 select out1(1) <= '1' when "000000"|"000010"|"000100"|"001010"|"010100"|"010110"|"011000"|"011110"| "000011"|"000101"|"000111"|"001001"|"001101"|"010011"|"010101"|"011011"| "100000"|"100100"|"101000"|"101010"|"110000"|"110010"|"110110"|"111100"| "100001"|"100011"|"101001"|"101111"|"110001"|"110111"|"111101"|"111111", '0' when others; with in1 select out1(2) <= '1' when "000000"|"001000"|"001010"|"001100"|"010000"|"010010"|"010100"|"011110"| "000011"|"000101"|"001001"|"001011"|"010001"|"010011"|"010111"|"011101"| "100100"|"101010"|"101100"|"101110"|"110000"|"110110"|"111000"|"111010"| "100001"|"100111"|"101111"|"110011"|"110101"|"110111"|"111001"|"111101", '0' when others; with in1 select out1(3) <= '1' when "000100"|"000110"|"001010"|"001100"|"010000"|"011000"|"011010"|"011110"| "000011"|"000101"|"001101"|"001111"|"010111"|"011001"|"011011"|"011101"| "100010"|"101000"|"101110"|"110000"|"110100"|"110110"|"111000"|"111100"| "100001"|"101011"|"101101"|"101111"|"110001"|"110011"|"110101"|"111111", '0' when others; end model_S1;
library ieee; use ieee.std_logic_1164.all; entity S2 is port(in2: in STD_LOGIC_VECTOR(0 to 5); out2: out STD_LOGIC_VECTOR(0 to 3)); end S2; architecture model_S2 of S2 is begin with in2 select out2(0) <= '1' when "000000"|"000100"|"000110"|"001010"|"010000"|"010110"|"011000"|"011110"| "000011"|"001001"|"001101"|"001111"|"010001"|"010111"|"011011"|"011101"| "100010"|"100110"|"101000"|"101100"|"110010"|"110100"|"111000"|"111110"| "100001"|"100011"|"100101"|"101011"|"110001"|"110111"|"111101"|"111111", '0' when others; with in2 select out2(1) <= '1' when "000000"|"000110"|"001000"|"001110"|"010010"|"010110"|"011000"|"011100"| "000011"|"000101"|"000111"|"001001"|"001111"|"010001"|"011001"|"011111"| "100010"|"100100"|"101010"|"101100"|"110000"|"110100"|"110110"|"111110"| "100001"|"101011"|"101101"|"110011"|"110101"|"110111"|"111011"|"111101", '0' when others; with in2 select out2(2) <= '1' when "000000"|"000110"|"001000"|"001010"|"001100"|"010010"|"010100"|"011110"| "000001"|"000111"|"001001"|"001011"|"001111"|"010111"|"011001"|"011101"| "100010"|"100100"|"100110"|"101000"|"110110"|"111010"|"111100"|"111110"| "100101"|"101001"|"101011"|"101111"|"110001"|"110011"|"110101"|"111101", '0' when others; with in2 select out2(3) <= '1' when "000000"|"000010"|"001010"|"001100"|"010000"|"010010"|"010110"|"011100"| "000001"|"000011"|"000111"|"001001"|"010101"|"011011"|"011101"|"011111"| "100100"|"100110"|"101100"|"101110"|"110000"|"111000"|"111010"|"111110"| "100001"|"100111"|"101001"|"101011"|"110001"|"110101"|"111011"|"111111", '0' when others; end model_S2;
library ieee; use ieee.std_logic_1164.all; entity S3 is port(in3: in STD_LOGIC_VECTOR(0 to 5); out3: out STD_LOGIC_VECTOR(0 to 3)); end S3; architecture model_S3 of S3 is begin with in3 select out3(0) <= '1' when "000000"|"000100"|"000110"|"001100"|"010010"|"010100"|"011000"|"011110"| "000001"|"000111"|"001111"|"010011"|"010111"|"011001"|"011011"|"011101"| "100000"|"100110"|"101000"|"101010"|"110000"|"110110"|"111010"|"111100"| "100011"|"100101"|"101011"|"101101"|"110011"|"110101"|"111001"|"111111", '0' when others; with in3 select out3(1) <= '1' when "000110"|"001000"|"001100"|"001110"|"010010"|"010100"|"010110"|"011010"| "000001"|"000011"|"001011"|"001101"|"010101"|"010111"|"011001"|"011101"| "100000"|"100010"|"100100"|"101010"|"110110"|"111000"|"111100"|"111110"| "100101"|"101001"|"101111"|"110001"|"110011"|"110101"|"111011"|"111111", '0' when others; with in3 select out3(2) <= '1' when "000000"|"000110"|"001000"|"001010"|"001100"|"010110"|"011000"|"011100"| "000011"|"001001"|"001101"|"001111"|"010001"|"010111"|"011011"|"011101"| "100010"|"101010"|"101100"|"110000"|"110100"|"111010"|"111100"|"111110"| "100011"|"101001"|"101111"|"110011"|"110101"|"110111"|"111001"|"111101", '0' when others; with in3 select out3(3) <= '1' when "000100"|"001010"|"001100"|"001110"|"010000"|"010010"|"010110"|"011000"| "000001"|"000011"|"000111"|"001001"|"010101"|"011011"|"011101"|"011111"| "100000"|"100110"|"101010"|"101100"|"110000"|"110010"|"111000"|"111110"| "100001"|"100101"|"101011"|"101111"|"110011"|"110111"|"111001"|"111011", '0' when others; end model_S3;
library ieee; use ieee.std_logic_1164.all; entity S4 is port(in4: in STD_LOGIC_VECTOR(0 to 5); out4: out STD_LOGIC_VECTOR(0 to 3)); end S4; architecture model_S4 of S4 is begin with in4 select out4(0) <= '1' when "000010"|"000100"|"001100"|"001110"|"010100"|"011000"|"011010"|"011110"| "000001"|"000011"|"000101"|"001011"|"010111"|"011011"|"011101"|"011111"| "100000"|"100100"|"101000"|"101010"|"101110"|"110000"|"110110"|"111100"| "100011"|"101001"|"101101"|"101111"|"110001"|"110111"|"111001"|"111111", '0' when others; with in4 select out4(1) <= '1' when "000000"|"000010"|"000100"|"001010"|"010110"|"011010"|"011100"|"011110"| "000001"|"000111"|"001001"|"001011"|"010001"|"010011"|"010111"|"011101"| "100010"|"101000"|"101100"|"101110"|"110000"|"110110"|"111000"|"111110"| "100011"|"100111"|"101101"|"110011"|"110101"|"111001"|"111011"|"111111", '0' when others; with in4 select out4(2) <= '1' when "000000"|"000100"|"000110"|"001010"|"001110"|"010010"|"011000"|"011110"| "000101"|"001001"|"001011"|"001111"|"010011"|"010101"|"011011"|"011101"| "100000"|"100010"|"101010"|"101100"|"110000"|"110100"|"110110"|"111010"| "100001"|"100011"|"100111"|"101001"|"110111"|"111011"|"111101"|"111111", '0' when others; with in4 select out4(3) <= '1' when "000000"|"000010"|"000110"|"001100"|"010000"|"010110"|"011000"|"011110"| "000001"|"000101"|"000111"|"001011"|"001111"|"010011"|"011001"|"011111"| "100100"|"101010"|"101100"|"101110"|"110000"|"110010"|"110100"|"111000"| "100001"|"100011"|"101011"|"101101"|"110001"|"110101"|"110111"|"111011", '0' when others; end model_S4;
library ieee; use ieee.std_logic_1164.all; entity S5 is port(in5: in STD_LOGIC_VECTOR(0 to 5); out5: out STD_LOGIC_VECTOR(0 to 3)); end S5; architecture model_S5 of S5 is begin with in5 select out5(0) <= '1' when "000010"|"001010"|"001100"|"010000"|"010110"|"011000"|"011100"|"011110"| "000001"|"000011"|"000111"|"001101"|"010101"|"010111"|"011011"|"011101"| "100110"|"101000"|"101010"|"101110"|"110000"|"110010"|"110100"|"111110"| "100001"|"100011"|"100101"|"101011"|"101111"|"110011"|"110111"|"111001", '0' when others; with in5 select out5(1) <= '1' when "000010"|"000100"|"001000"|"001110"|"010010"|"010110"|"011000"|"011100"| "000001"|"000111"|"001001"|"001011"|"001101"|"010001"|"010101"|"011111"| "100000"|"101010"|"101100"|"110000"|"110100"|"110110"|"111000"|"111110"| "100101"|"100111"|"101011"|"101111"|"110001"|"110011"|"111011"|"111101", '0' when others; with in5 select out5(2) <= '1' when "000000"|"001000"|"001010"|"001100"|"001110"|"010100"|"010110"|"011100"| "000001"|"000011"|"000101"|"001011"|"010101"|"010111"|"011001"|"011111"| "100010"|"100110"|"101000"|"101100"|"110000"|"111000"|"111010"|"111110"| "100001"|"100111"|"101011"|"101101"|"110001"|"110011"|"111001"|"111111", '0' when others; with in5 select out5(3) <= '1' when "000110"|"001000"|"001100"|"010010"|"010100"|"010110"|"011000"|"011110"| "000011"|"001011"|"001101"|"001111"|"010001"|"010101"|"011001"|"011011"| "100100"|"100110"|"101010"|"101100"|"110000"|"110010"|"110110"|"111010"| "100001"|"100111"|"101001"|"101111"|"110011"|"110111"|"111101"|"111111", '0' when others; end model_S5;
library ieee; use ieee.std_logic_1164.all; entity S6 is port(in6: in STD_LOGIC_VECTOR(0 to 5); out6: out STD_LOGIC_VECTOR(0 to 3)); end S6; architecture model_S6 of S6 is begin with in6 select out6(0) <= '1' when "000000"|"000100"|"000110"|"001000"|"001110"|"010010"|"011000"|"011110"| "000001"|"000011"|"001011"|"001101"|"010101"|"010111"|"011011"|"011111"| "100000"|"100010"|"100100"|"101010"|"101100"|"110110"|"111010"|"111100"| "100111"|"101001"|"101101"|"101111"|"110001"|"110011"|"111101"|"111111", '0' when others; with in6 select out6(1) <= '1' when "000000"|"000110"|"001100"|"010010"|"010110"|"011000"|"011010"|"011100"| "000011"|"000101"|"001001"|"001011"|"001111"|"010001"|"010101"|"010111"| "100010"|"100100"|"100110"|"101100"|"110000"|"110100"|"111010"|"111110"| "100001"|"100111"|"101011"|"101101"|"110011"|"110111"|"111001"|"111111", '0' when others; with in6 select out6(2) <= '1' when "000100"|"000110"|"001010"|"001100"|"010100"|"011000"|"011010"|"011110"| "000001"|"000011"|"000111"|"001001"|"010001"|"010111"|"011011"|"011101"| "100010"|"100100"|"101000"|"101110"|"110000"|"110110"|"111100"|"111110"| "100011"|"100101"|"101101"|"101111"|"110001"|"110011"|"110111"|"111001", '0' when others; with in6 select out6(3) <= '1' when "000010"|"000110"|"001000"|"010010"|"010100"|"011010"|"011100"|"011110"| "000011"|"001001"|"001101"|"001111"|"010011"|"010101"|"011011"|"011101"| "100000"|"100100"|"100110"|"101110"|"110000"|"111000"|"111010"|"111100"| "100011"|"101001"|"101011"|"101101"|"110001"|"110101"|"110111"|"111111", '0' when others; end model_S6;
library ieee; use ieee.std_logic_1164.all; entity S7 is port(in7: in STD_LOGIC_VECTOR(0 to 5); out7: out STD_LOGIC_VECTOR(0 to 3)); end S7; architecture model_S7 of S7 is begin with in7 select out7(0) <= '1' when "000010"|"000110"|"001000"|"001100"|"001110"|"010010"|"010100"|"011010"| "000001"|"000101"|"001011"|"001111"|"010001"|"010111"|"011011"|"011101"| "100100"|"100110"|"101000"|"101110"|"110000"|"110010"|"110110"|"111100"| "100011"|"100101"|"100111"|"101101"|"110001"|"110111"|"111001"|"111111", '0' when others; with in7 select out7(1) <= '1' when "000000"|"000110"|"001000"|"001110"|"010010"|"010110"|"011000"|"011100"| "000001"|"000111"|"001001"|"010001"|"010101"|"010111"|"011011"|"011111"| "100010"|"100110"|"101000"|"101100"|"101110"|"110010"|"110100"|"111010"| "100001"|"100101"|"101011"|"101111"|"110011"|"110111"|"111001"|"111111", '0' when others; with in7 select out7(2) <= '1' when "000010"|"000100"|"000110"|"001000"|"010000"|"010110"|"011010"|"011100"| "000101"|"000111"|"001111"|"010001"|"010011"|"011001"|"011011"|"011111"| "100100"|"101010"|"101100"|"101110"|"110000"|"110010"|"110100"|"111110"| "100001"|"100011"|"101101"|"101111"|"110111"|"111001"|"111011"|"111101", '0' when others; with in7 select out7(3) <= '1' when "000010"|"001000"|"001110"|"010000"|"010100"|"010110"|"011000"|"011110"| "000001"|"000101"|"000111"|"001011"|"001101"|"010011"|"010101"|"011011"| "100000"|"100100"|"100110"|"101010"|"101100"|"110010"|"111010"|"111100"| "100011"|"100101"|"101001"|"101111"|"110001"|"110011"|"110111"|"111101", '0' when others; end model_S7;
library ieee; use ieee.std_logic_1164.all; entity S8 is port(in8: in STD_LOGIC_VECTOR(0 to 5); out8: out STD_LOGIC_VECTOR(0 to 3)); end S8; architecture model_S8 of S8 is begin with in8 select out8(0) <= '1' when "000000"|"000100"|"001010"|"001100"|"010000"|"010010"|"010110"|"011100"| "000011"|"000101"|"000111"|"001001"|"010001"|"010111"|"011011"|"011101"| "100010"|"101000"|"101010"|"101100"|"110100"|"110110"|"111000"|"111110"| "100101"|"101011"|"101101"|"101111"|"110001"|"110011"|"110101"|"111111", '0' when others; with in8 select out8(1) <= '1' when "000000"|"000110"|"001000"|"001010"|"010110"|"011000"|"011100"|"011110"| "000011"|"000101"|"001101"|"001111"|"010001"|"010011"|"010101"|"011011"| "100000"|"100100"|"101010"|"101100"|"110010"|"110110"|"111000"|"111100"| "100101"|"100111"|"101001"|"101111"|"110001"|"110011"|"111011"|"111101", '0' when others; with in8 select out8(2) <= '1' when "000010"|"001000"|"001010"|"001100"|"010000"|"010100"|"010110"|"011110"| "000011"|"001001"|"001011"|"001101"|"010101"|"010111"|"011011"|"011111"| "100000"|"100010"|"101100"|"101110"|"110010"|"110100"|"111000"|"111010"| "100001"|"100101"|"100111"|"101011"|"110001"|"111001"|"111101"|"111111", '0' when others; with in8 select out8(3) <= '1' when "000000"|"001010"|"001100"|"001110"|"010010"|"010100"|"011000"|"011110"| "000001"|"000011"|"000101"|"001011"|"001101"|"010011"|"010111"|"011101"| "100000"|"100010"|"100110"|"101000"|"110110"|"111000"|"111010"|"111100"| "100011"|"100111"|"101111"|"110001"|"110101"|"111001"|"111011"|"111111", '0' when others; end model_S8;
Код програми: library ieee, my_lib; use ieee.std_logic_1164.all, my_lib.my_func.all; entity DES is port (my_in: in STD_LOGIC_VECTOR(0 to 5); my_out: out STD_LOGIC_VECTOR(0 to 3)); end DES;
architecture S of DES is component S1 port(in1: in STD_LOGIC_VECTOR(0 to 5); out1: out STD_LOGIC_VECTOR(0 to 3)); end component;
component S2 port(in2: in STD_LOGIC_VECTOR(0 to 5); out2: out STD_LOGIC_VECTOR(0 to 3)); end component;
component S3 port(in3: in STD_LOGIC_VECTOR(0 to 5); out3: out STD_LOGIC_VECTOR(0 to 3)); end component;
component S4 port(in4: in STD_LOGIC_VECTOR(0 to 5); out4: out STD_LOGIC_VECTOR(0 to 3)); end component;
component S5 port(in5: in STD_LOGIC_VECTOR(0 to 5); out5: out STD_LOGIC_VECTOR(0 to 3)); end component;
component S6 port(in6: in STD_LOGIC_VECTOR(0 to 5); out6: out STD_LOGIC_VECTOR(0 to 3)); end component;
component S7 port(in7: in STD_LOGIC_VECTOR(0 to 5); out7: out STD_LOGIC_VECTOR(0 to 3)); end component;
component S8 port(in8: in STD_LOGIC_VECTOR(0 to 5); out8: out STD_LOGIC_VECTOR(0 to 3)); end component;
signal x1, x2, x3, x4, x5, x6, x7, x8: STD_LOGIC_VECTOR(0 to 5); signal out1, out2, out3, out4, out5, out6, out7, out8: STD_LOGIC_VECTOR(0 to 3); begin U1: S1 port map (x1, out1); U2: S2 port map (x2, out2); U3: S3 port map (x3, out3); U4: S4 port map (x4, out4); U5: S5 port map (x5, out5); U6: S6 port map (x6, out6); U7: S7 port map (x7, out7); U8: S8 port map (x8, out8); end S;
Список ідентифікаторів
Висновки В результаті виконання даної роботи по розробленню VHDL опису та синтезу елементів пристрою для реалізації підстановки в S-блоках алгоритму DES була написана програма. Перший лістинг програми представляє собою поведінковий опис пристрою. Другий лістинг являє собою структурну форму опису пристрою. Після проведення симуляції роботи даних програм в середовищі САПР Aldec Riviera 2004, були отримані результати роботи, які були представлені у вигляді двійкових діаграм. При симуляції обох програм ми отримали одинаковий результат, що вказує направельність результату.
Дата добавления: 2015-08-31; Просмотров: 246; Нарушение авторских прав?; Мы поможем в написании вашей работы! Нам важно ваше мнение! Был ли полезен опубликованный материал? Да | Нет |