1 / 40

VHDL

VHDL. ELEC 418 Advanced Digital Systems Dr. Ron Hayne Images Courtesy of Thomson Engineering. Design Flow. VHDL Modules. VHDL Libraries. library IEEE; use IEEE.std_logic_1164.all; std_logic Single-bit signals std_logic_vector Multi-bit signals. Full Adder (Dataflow). library IEEE;

johana johana
Download Presentation

VHDL

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. VHDL ELEC 418 Advanced Digital Systems Dr. Ron Hayne Images Courtesy of Thomson Engineering

  2. Design Flow 418_02

  3. VHDL Modules 418_02

  4. VHDL Libraries • library IEEE; • use IEEE.std_logic_1164.all; • std_logic • Single-bit signals • std_logic_vector • Multi-bit signals 418_02

  5. Full Adder (Dataflow) library IEEE; use IEEE.STD_LOGIC_1164.ALL; entity FullAdder is port(X, Y, Cin: in std_logic; --Inputs Cout, Sum: out std_logic); --Outputs end FullAdder; architecture Dataflow of FullAdder is begin -- concurrent assignment statements Sum <= X xor Y xor Cin after 2 ns; Cout <= (X and Y) or (X and Cin) or (Y and Cin) after 2 ns; end Dataflow; 418_02

  6. 4-bit Ripple-Carry Adder entity Adder4 is port(A, B: in std_logic_vector(3 downto 0); Ci: in std_logic; S: out std_logic_vector(3 downto 0); Co: out std_logic); end Adder4; 418_02

  7. 4-bit Adder (Structural) architecture Structure of Adder4 is component FullAdder port(X, Y, Cin: in std_logic; -- Inputs Cout, Sum: out std_logic); -- Outputs end component; signal C: std_logic_vector(3 downto 1); -- internal begin --instantiate four copies of the FullAdder FA0: FullAdder port map(A(0),B(0),Ci,C(1),S(0)); FA1: FullAdder port map(A(1),B(1),C(1),C(2),S(1)); FA2: FullAdder port map(A(2),B(2),C(2),C(3),S(2)); FA3: FullAdder port map(A(3),B(3),C(3),Co,S(3)); end Structure; 418_02

  8. VHDL Test Bench constant PERIOD: time := 10 ns; BEGIN stim_proc: process begin wait for PERIOD; A <= "0011"; B <= "0010"; Ci <= '0'; wait for PERIOD; B <= "1110"; wait; end process; END; 418_02

  9. VHDL Simulation 418_02

  10. VHDL Processes (Behavioral) • D Flip-Flop with Asyncronous Clear 418_02

  11. Bit '0' or '1' Bit_Vector "00", "01", "10", ... Boolean FALSE or TRUE Time integer with units fs, ps, ns, us, ms, ... Integer Real Character 'a', 'b', '1', '2', ... Enumeration Type User defined VHDL Data Types 418_02

  12. IEEE 1164 Standard Logic • 9-Valued Logic System • 'U' Uninitialized • 'X' Forcing Unknown • '0' Forcing 0 • '1' Forcing 1 • 'Z' High Impedance • 'W' Weak Unknown • 'L' Weak 0 • 'H' Weak 1 • '-' Don't Care 418_08

  13. Logical and, or, nand, nor, xor Relational =, /=, <, <=, >, >= Shift sll, srl, sla, sra, rol, ror Addition +, - Concatenation & Unary Sign +, - Multiplication *, /, mod, rem Miscellaneous not, abs, ** VHDL Operators 418_02

  14. VHDL Synthesis Example entity Q3 is port(A, B, F, CLK: in std_logic; G: out std_logic); end Q3; architecture circuit of Q3 is signal C: std_logic; begin process(CLK) begin if rising_edge(CLK) then C <= A and B; -- statement 1 G <= C or F; -- statement 2 end if; end process; end circuit; 418_02

  15. S Multiplexers entity MUX2to1 is port(I1, I0, S: in std_logic; F: out std_logic); end MUX2to1; architecture Dataflow of MUX2to1 is begin F <= I0 when S = '0' else I1; end Dataflow; 418_02

  16. Multiplexers entity MUX4to1 is port(I: in std_logic_vector(3 downto 0); S: in std_logic_vector(1 downto 0); F: out std_logic); end MUX4to1; architecture Dataflow of MUX4to1 is begin with S select F <= I(0) when "00", I(1) when "01", I(2) when "10", I(3) when "11"; end Dataflow; 418_02

  17. VHDL Libraries • library IEEE; • use IEEE.std_logic_1164.all; • Types std_logic and std_logic_vector • use IEEE.std_logic_unsigned.all; • Overloaded operators • Conversion functions 418_02

  18. 4-bit Adder (Overload) library IEEE; use IEEE.std_logic_1164.all; use IEEE.std_logic_unsigned.all; entity Adder4 is port(A, B: in std_logic_vector(3 downto 0); Ci: in std_logic; S: out std_logic_vector(3 downto 0); Co: out std_logic); end Adder4; 418_02

  19. 4-bit Adder (Overload) architecture Overload of Adder4 is signal Sum5: std_logic_vector(4 downto 0); begin Sum5 <= ('0' & A) + (‘0’ & B) + (“0000” & Ci); S <= Sum5(3 downto 0); Co <= Sum5(4); end Overload; 418_02

  20. Shift Register • Left Shift Register • Synchronous Clear and Load 418_02

  21. 74163 Binary Counter (clear) (parallel load) (no change) (increment count) 418_02

  22. VHDL Counter (Behavioral) -- 74163 FULLY SYNCHRONOUS COUNTER library IEEE; use IEEE.std_logic_1164.all; use IEEE.std_logic_unsigned.all; entity Counter74163 is port(LdN, ClrN, P, T, Clk: in std_logic; D: in std_logic_vector(3 downto 0); Cout: out std_logic; Qout: out std_logic_vector(3 downto 0)); end Counter74163; 418_02

  23. VHDL Counter (Behavioral) architecture Behave of Counter74163 is signal Q: std_logic_vector(3 downto 0) := "0000"; begin process(Clk) begin if rising_edge(Clk) then if ClrN = '0' then Q <= "0000"; elsif LdN = '0' then Q <= D; elsif (P and T) = '1' then Q <= Q + 1; end if; end if; end process; Qout <= Q; Cout <= '1' when Q = "1111" and T = '1' else '0'; end Behave; 418_02

  24. 8-bit Counter 418_02

  25. VHDL Counter (Structural) library IEEE; use IEEE.std_logic_1164.all; entity Eight_Bit_Counter is port(ClrN, LdN, P, T1, Clk: in std_logic; Din1, Din2: in std_logic_vector(3 downto 0); Qout: out std_logic_vector(7 downto 0); Carry2: out std_logic); end Eight_Bit_Counter; 418_02

  26. VHDL Counter (Structural) architecture Structure of Eight_Bit_Counter is component Counter74163 is port(LdN, ClrN, P, T, Clk: in std_logic; D: in std_logic_vector(3 downto 0); Cout: out std_logic; Qout: out std_logic_vector(3 downto 0)); end component; signal Carry1: std_logic; signal Qout1, Qout2: std_logic_vector(3 downto 0); 418_02

  27. VHDL Counter (Structural) begin ct1: Counter74163 port map(LdN,ClrN,P,T1,Clk, Din1,Carry1,Qout1); ct2: Counter74163 port map(LdN,ClrN,P,Carry1,Clk, Din2, Carry2, Qout2); Qout <= Qout2 & Qout1; end Structure; 418_02

  28. Sequential Machine 418_02

  29. Sequential Machine 418_02

  30. Behavioral Model entity Sequence_Detector is port(X, CLK: in std_logic; Z: out std_logic); end Sequence_Detector; architecture Behave of Sequence_Detector is signal State: integer range 0 to 2 := 0; begin process(CLK) begin if rising_edge(Clk) then 418_02

  31. Behavioral Model case State is when 0 => if X = '0' then State <= 0; else State <= 1; end if; when 1 => if X = '0' then State <= 2; else State <= 1; end if; 418_02

  32. Behavioral Model when 2 => if X = '0' then State <= 0; else State <= 1; end if; end case; end if; end process; Z <= '1' when (State = 2 and X = '1') else '0'; end Behave; 418_02

  33. Additional VHDL • Variables, Signals and Constants • Arrays • Loops • Assert and Report Statements 418_02

  34. Look-Up Tables 418_02

  35. Look-Up Tables library IEEE; use IEEE.std_logic_1164.all; use IEEE.std_logic_unsigned.all; entity Parity_Gen is Port(X: in std_logic_vector(3 downto 0); Y: out std_logic_vector(4 downto 0)); end Parity_Gen; 418_02

  36. Look-Up Tables architecture Table of Parity_Gen is type OutTable is array(0 to 15) of std_logic; signal ParityBit: std_logic; constant OT: OutTable := ('1','0','0','1','0','1','1','0', '0','1','1','0','1','0','0','1'); begin ParityBit <= OT(conv_integer(X)); Y <= X & ParityBit; end Table; 418_02

  37. 4-bit Adder Test Bench constant PERIOD: time := 10 ns; -- Test vector arrays constant N: integer := 4; type arr1 is array(1 to N) of std_logic; type arr2 is array(1 to N) of std_logic_vector(3 downto 0); constant A_array: arr2:= ( "0011", "0011", "0011", "1101"); constant B_array: arr2 := ( "0010", "1110", "1101", "0010"); constant Ci_array: arr1 := ( '0', '0', '1', '0'); constant Co_array: arr1:= ('0', '1', '1', '0' ); constant S_array: arr2 := ( "0101", "0001", "0001", "1111"); 418_02

  38. 4-bit Adder Test Bench -- Stimulus process stim_proc: process begin for i in 1 to N loop A <= A_array(i); B <= B_array(i); Ci <= Ci_array(i); wait for PERIOD; assert (S = S_array(i) and Co = Co_array(i)) report "Wrong Answer" severity error; end loop; report "Test Finished"; end process; 418_02

  39. VHDL Simulation 418_02

  40. VHDL Summary • Entity • Architecture • Dataflow • Structural • Behavioral • Data Types and Operators • Synthesis • Libraries • Simulation • Test Benches 418_02

More Related

玻璃钢生产厂家深圳特色商场美陈售价滁州玻璃钢雕塑加工厂红色玻璃钢人物雕塑推荐货源梅州玻璃钢雕塑分类湖北园林玻璃钢雕塑玻璃钢不锈钢景观雕塑报价玻璃钢花盆市场报价秭归玻璃钢造型雕塑厦门玻璃钢雕塑制品厂青岛胶州玻璃钢雕塑九江玻璃钢马雕塑上海户外商场美陈销售公司圣诞玻璃钢雕塑定做厂家玻璃钢泡沫雕塑价格安宁玻璃钢大型雕塑设计永济玻璃钢仿铜雕塑桂林市玻璃钢雕塑定制九江多彩玻璃钢雕塑常宁玻璃钢仿铜雕塑云南商场美陈费用上海进口玻璃钢雕塑销售价格供销玻璃钢动漫雕塑厂附近玻璃钢鹿雕塑厂家浙江大型商场美陈销售企业安徽蘑菇玻璃钢雕塑蒙城商场国庆美陈福建仿铜玻璃钢雕塑优势云南玻璃钢卡通雕塑公司铜陵人物玻璃钢雕塑多少钱合肥玻璃钢卡通雕塑供应商香港通过《维护国家安全条例》两大学生合买彩票中奖一人不认账让美丽中国“从细节出发”19岁小伙救下5人后溺亡 多方发声单亲妈妈陷入热恋 14岁儿子报警汪小菲曝离婚始末遭遇山火的松茸之乡雅江山火三名扑火人员牺牲系谣言何赛飞追着代拍打萧美琴窜访捷克 外交部回应卫健委通报少年有偿捐血浆16次猝死手机成瘾是影响睡眠质量重要因素高校汽车撞人致3死16伤 司机系学生315晚会后胖东来又人满为患了小米汽车超级工厂正式揭幕中国拥有亿元资产的家庭达13.3万户周杰伦一审败诉网易男孩8年未见母亲被告知被遗忘许家印被限制高消费饲养员用铁锨驱打大熊猫被辞退男子被猫抓伤后确诊“猫抓病”特朗普无法缴纳4.54亿美元罚金倪萍分享减重40斤方法联合利华开始重组张家界的山上“长”满了韩国人?张立群任西安交通大学校长杨倩无缘巴黎奥运“重生之我在北大当嫡校长”黑马情侣提车了专访95后高颜值猪保姆考生莫言也上北大硕士复试名单了网友洛杉矶偶遇贾玲专家建议不必谈骨泥色变沉迷短剧的人就像掉进了杀猪盘奥巴马现身唐宁街 黑色着装引猜测七年后宇文玥被薅头发捞上岸事业单位女子向同事水杯投不明物质凯特王妃现身!外出购物视频曝光河南驻马店通报西平中学跳楼事件王树国卸任西安交大校长 师生送别恒大被罚41.75亿到底怎么缴男子被流浪猫绊倒 投喂者赔24万房客欠租失踪 房东直发愁西双版纳热带植物园回应蜉蝣大爆发钱人豪晒法院裁定实锤抄袭外国人感慨凌晨的中国很安全胖东来员工每周单休无小长假白宫:哈马斯三号人物被杀测试车高速逃费 小米:已补缴老人退休金被冒领16年 金额超20万

玻璃钢生产厂家 XML地图 TXT地图 虚拟主机 SEO 网站制作 网站优化