eda技术及应用教程—部分习题参考答案内容摘要:

nd if。 end process。 end art。 2) 8 位 左 移寄存器模块源程序 library ieee。 use。 entity shiftl_8 is port(clk,load:in std_logic。 b: in std_logic_vector(3 downto 0)。 qout: buffer std_logic_vector(7 downto 0))。 end。 architecture art of shiftl_8 is begin process(clk,load) variable q: std_logic_vector(8 downto 0)。 begin if load=39。 139。 then q(8 downto 0):=00000amp。 b(3 downto 0)。 qout(7 downto 0)=q(7 downto 0)。 elsif clk39。 event and clk=39。 139。 then q(8 downto 1):= q(7 downto 0)。 q(0):=39。 039。 qout(7 downto 0)=q(8 downto 1)。 end if。 end process。 58 end art。 3) 8 位加法器模块源程序 library ieee。 use。 use。 entity adder8b is port(a,b: in std_logic_vector(7 downto 0)。 s: out std_logic_vector(7 downto 0))。 end adder8b。 architecture art of adder8b is signal sint:std_logic_vector(8 downto 0)。 signal aa,bb:std_logic_vector(8 downto 0)。 begin aa=39。 039。 amp。 a。 bb=39。 039。 amp。 b。 sint=aa+bb。 s=sint(7 downto 0)。 end art。 4) 8 位锁存器模块源程序 library ieee。 use。 entity latch8 is port(clk,clr: std_logic。 d: in std_logic_vector(7 downto 0)。 qx: buffer std_logic_vector(7 downto 0))。 end。 architecture art of latch8 is begin process(clk,clr) begin if clr=39。 139。 then qx=00000000。 elsif clk39。 event and clk=39。 139。 then qx=d。 end if。 end process。 end art。 5)与 模块源程序 library ieee。 use。 entity andl is port(x:in std_logic。 bb: in std_logic_vector(7 downto 0)。 qt: out std_logic_vector(7 downto 0))。 end。 architecture art of andl is begin process(x,bb) begin for i in 0 to 7 loop 59 qt(i)=bb(i)and x。 end loop。 end process。 end art。 6)控制器模块源程序 library ieee。 use。 entity enable is port(clk,en:in std_logic。 clock: out std_logic)。 end。 architecture art of enable is begin process(clk,en) begin clock=clk and (not en)。 end process。 end art。 顶层 模块源程序: library ieee。 use。 library work。 entity multiplier44 is port( clk : in std_logic。 enable : in std_logic。 a : in std_logic _vector(3 downto 0)。 b : in std_logic _vector (3 downto 0)。 m : out std_logic _vector (7 downto 0))。 end multiplier44。 architecture bdf_type of multiplier44 is ponent shiftl_8 port( clk : in std_logic。 load : in std_logic。 b : in std_logic _vector (3 downto 0)。 qout : out std_logic _vector (7 downto 0))。 end ponent。 ponent enable port( clk : in std_logic。 en : in std_logic。 clock : out std_logic )。 end ponent。 ponent andl port (x : in std_logic。 bb : in std_logic _vector (7 downto 0)。 qt : out std_logic _vector (7 downto 0))。 end ponent。 ponent latch8 60 port (clk : in std_logic。 clr : in std_logic。 d : in std_logic _vector (7 downto 0)。 qx : out std_logic _vector (7 downto 0))。 end ponent。 ponent shiftr_4 port (clk : in std_logic。 load : in std_logic。 a : in std_logic _vector (3 downto 0)。 qout : out std_logic)。 end ponent。 ponent adder8b port (a : in std_logic _vector (7 downto 0)。 b : in std_logic _vector (7 downto 0)。 s : out std_logic _vector (7 downto 0) )。 end ponent。 signal synthesized_wire_8 : std_logic。 signal synthesized_wire _1 : std_logic。 signal synthesized_wire _2 : std_logic _vector (7 downto 0)。 signal synthesized_wire _4 : std_logic _vector (7 downto 0)。 signal synthesized_wire _6 : std_logic _vector (7 downto 0)。 signal synthesized_wire _7 : std_logic _vector (7 downto 0)。 begin m = synthesized_wire _6。 b2v_inst : shiftl_8 port map(clk = synthesized_wire _8, load = enable, b = b, qout = synthesized_wire _2)。 b2v_inst1 : enable port map (clk = clk, en = enable, clock = synthesized_wire _8)。 b2v_inst2 : andl port map (x = synthesized_wire _1, bb = synthesized_wire _2, qt = synthesized_wire _7)。 b2v_inst5 : latch8 port map (clk = synthesized_wire _8, clr = enable, d = synthesized_wire _4, qx = synthesized_wire _6)。 b2v_inst6 : shiftr_4 port map (clk = synthesized_wire _8, load = enable, a = a, 61 qout = synthesized_wire _1)。 b2v_inst7 : adder8b port map (a = synthesized_wire _6, b = synthesized_wire _7, s = synthesized_wire _4)。 end。 顶层模块还可采用 原理图输入法,参考原理图如图 所示: 图 仿真波形如图 所示: 图 习题 6 : library ieee。 use。 entity pencoder is port(d:in std_logic_vector(15 downto 0)。 ei:in std_logic。 ei:enable input 62 gs,eo:out bit。 gs:chip select output。 eo:enable output q3,q2,q1,q0:out std_logic)。 end pencoder。 architecture encoder of pencoder is begin process(d) begin if(d(0)=39。 039。 and ei=39。 039。 )then q3=39。 139。 q2=39。 139。 q1=39。 139。 q0=39。 139。 gs=39。 039。 eo=39。 139。 elsif(d(1)=39。 039。 and ei=39。 039。 )then q3=39。 139。 q2=39。 139。 q1=39。 139。 q0=39。 039。 gs=39。 039。 eo=39。 139。 elsif(d(2)=39。 039。 and ei=39。 039。 )then q3=39。 139。 q2=39。 139。 q1=39。 039。 q0=39。 139。 gs=39。 039。 eo=39。 139。 elsif(d(3)=39。 039。 and ei=39。 039。 )then q3=39。 139。 q2=39。 139。 q1=39。 039。 q0=39。 039。 gs=39。 039。 eo=39。 139。 elsif(d(4)=39。 039。 and ei=39。 039。 )then q3=39。 139。 q2=39。 039。 q1=39。 139。 q0=39。 139。 gs=39。 039。 eo=39。 139。 elsif(d(5)=39。 039。 and ei=39。 039。 )then q3=39。 139。 q2=39。 039。 q1=39。 139。 q0=39。 039。 gs=39。 039。 eo=39。 139。 elsif(d(6)=39。 039。 and ei=39。 039。 )then q3=39。 139。 q2=39。 039。 q1=39。 039。 q0=39。 139。 gs=39。 039。 eo=39。 139。 elsif(d(7)=39。 039。 and ei=39。 039。 )then q3=39。 139。 q2=39。 039。 q1=39。 039。 q0=39。 039。 gs=39。 039。 eo=39。 139。 elsif(d(8)=39。 039。 and ei=39。 039。 )then q3=39。 039。 q2=39。 139。 q1=39。 139。 q0=39。 139。 gs=39。 039。 eo=39。 139。 elsif(d(9)=39。 039。 and ei=39。 039。 )then q3=39。 039。 q2=39。 139。 q1=39。 139。 q0=39。 039。 gs=39。 039。 eo=39。 139。 elsif(d(10)=39。 039。 and ei=39。 039。 )t。
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。 用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。