盛建伦:《数字逻辑与VHDL逻辑设计》习题解答
1 1 0 0
1 1 0 1 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 1 1 0 0 1 1 0 0 0
1 0 0 0 1 0 0 1 1 0 1 0 1 0 1 1 1 1 0 0 1 1 0 1 1 1 1 0 1 1 1 1
根据系统框图写VHDL程序的Entity,用行为描述的方法,根据真值表写VHDL程序的Architecture。
VHDL程序如下: --Gray code to Binary code library ieee;
use ieee.std_logic_1164.all; entity gray2binary is
port( grayin : in std_logic_vector(3 downto 0); binaryout : out std_logic_vector(3 downto 0)); end gray2binary;
architecture behave of gray2binary is begin
with grayin select
binaryout <= \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ end behave;
4 - 16
盛建伦:《数字逻辑与VHDL逻辑设计》习题解答
4-22
用VHDL设计一个代码转换逻辑电路。把4位二进制代码转换成7段字符显示代码。能显示数字0~9和字母A,b,C,d,E,F。
解:电路的输入是4位代码,输出是7位代码。用D3~D0作为输入信号名,用Ya~Yg作为输出信号名,分别对应a、b、c、d、e、f、g这7个段。
系统框图 ……
列出代码转换逻辑的真值表。
表4.12 代码转换逻辑电路的真值表
D3 D2 D1 D0 Ya Yb Yc Yd Ye Yf Yg 0 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 0 1 0 1 0 1 1 0 0 1 1 1 1 0 0 0 1 0 0 1 1 0 1 0 1 0 1 1 1 1 0 0 1 1 0 1 1 1 1 0 1 1 1 1
根据系统框图设计VHDL程序的entity,用行为描述的方法,根据真值表设
4 - 17
Ya Yb Yc Yd Ye Yf Yg 代码转换电路 D3 D2 D1 D0 … 显示字符 0 1 2 3 4 5 6 7 8 9 A b C d E F 字形 1 1 1 1 1 1 0 0 1 1 0 0 0 0 1 1 0 1 1 0 1 1 1 1 1 0 0 1 0 1 1 0 0 1 1 1 0 1 1 0 1 1 1 0 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 0 1 1 1 0 0 1 1 1 1 1 1 0 0 1 1 1 0 0 1 1 1 1 0 1 1 0 0 1 1 1 1 1 0 0 0 1 1 1 盛建伦:《数字逻辑与VHDL逻辑设计》习题解答
计VHDL程序的architecture。
library ieee;
use ieee.std_logic_1164.all; entity bcd2seg7 is
port( bcdin : in std_logic_vector(3 downto 0); segout : out std_logic_vector(6 downto 0)); end bcd2seg7;
architecture behav of bcd2seg7 is begin
with bcdin select
segout <= \ --display\ \ \ \
\ \ \
\ --display\ \
\ --display\ \ --display\ \ --display\ \ --display\ \ --display\ \ --display\ \ --display\ \end behave;
4-22 (有没有简单方法呢?)
用VHDL设计一个代码转换逻辑电路。把7位的ASCII码转换成7段字符显示代码。能显示数字0~9,字母A,b,C,d,E,F,H,L,o,P,U,等。
解:
ASCII码 7段字符显示代码 Yg 字形 0 字符 A6 A5 A4 A3 A2 A1 A0 Ya Yb Yc Yd Ye Yf 0 0 1 1 0 0 0 0 1 1 1 1 1 1 4 - 18
盛建伦:《数字逻辑与VHDL逻辑设计》习题解答
1 2 3 4 5 6 7 8 9 A b C d E F H L o P U
0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 0 0 0 0 1 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 1 1 1 0 0 0 0 0 1 1 1 1 0 0 0 0 0 1 1 1 0 1 1 0 1 0 1 1 0 0 1 1 0 0 0 1 1 0 0 1 0 0 1 0 0 1 0 1 0 1 0 1 0 1 1 0 1 0 1 0 0 0 1 0 1 0 1 1 0 1 1 1 1 1 1 0 1 0 1 1 0 0 0 1 0 1 1 1 1 0 0 1 1 1 1 0 0 1 0 0 1 0 0 1 1 1 0 1 1 1 1 1 1 1 1 1 0 1 0 0 1 0 1 0 1 0 1 1 0 1 1 0 1 0 0 1 1 1 1 0 0 1 1 0 1 0 1 0 0 0 1 0 1 0 1 1 1 1 1 1 1 1 1 1 1 0 0 0 1 1 1 0 1 1 1 1 1 0 1 1 1 1 0 1 1 0 1 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 1 0 4-23 用VHDL设计一个16位全加器。 解:
4-24
用VHDL设计一个8位数值比较器。 解:
4-25 用VHDL设计一个四位超前进位加法器。 解:
4 - 19
盛建伦:《数字逻辑与VHDL逻辑设计》习题解答
-- 4-Bit carry-look-ahead Full Adder library ieee;
use ieee.std_logic_1164.all; entity FULL_ADDER1 is
port ( A, B : in bit_vector(3 downto 0); Cin : in bit;
S : out bit_vector(3 downto 0); Cout : out BIT); end FULL_ADDER1; --
architecture FULL_ADDERp of FULL_ADDER1 is signal sA,sB,sS : bit_vector(3 downto 0); signal sCin , sCout : bit ; signal sC : bit_vector(3 downto 0) ; signal sT : bit_vector(3 downto 0) ; signal sG : bit_vector(3 downto 0) ; begin sA <= A ; sB <= B ; sCin <= Cin ;
sT(0) <= sA(0) xor sB(0) ; --P0 sG(0) <= sA(0) and sB(0) ; --G0 sT(1) <= sA(1) xor sB(1) ; --P1 sG(1) <= sA(1) and sB(1) ; --G1 sT(2) <= sA(2) xor sB(2) ; --P2 sG(2) <= sA(2) and sB(2) ; --G2 sT(3) <= sA(3) xor sB(3) ; --P3
sG(3) <= sA(3) and sB(3) ; --G3 --
sC(0)<=sG(0) or (sT(0) And sCin) ; --C0
sC(1)<=sG(1) or (sT(1) and (sG(0) or (sT(0) and sCin))); --C1
sC(2)<=sG(2) or (sT(2) and (sG(1) or (sT(1) and (sG(0) or (sT(0) and sCin))))); --C2 sC(3)<=sG(3) or (sT(3) and (sG(2) or (sT(2) and (sG(1) or (sT(1) and (sG(0) or (sT(0) and sCin))))))); --C3
--
sS(0) <= sT(0) xor sCin ; --S0 sS(1) <= sT(1) xor sC(0) ; --S1 sS(2) <= sT(2) xor sC(1) ; --S2
4 - 20
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库数字逻辑第四章课后答案(4)在线全文阅读。
相关推荐: