Title: ??????? ??? ?? VHDL? ??? ??
1??????? ??? ?? VHDL? ??? ??
2002???????????
- "? ??? 2002?? ????????? ???? ??? ??? ??
(KRF-2002-048-D00058)" - " This work was supported by Korea Research
Foundation Grant. (KRF-2002-048-D00058)"
2?1? ??(object)? ??(statement)
?3? ??? ??? ? ???
- ? ??(data object)
- VHDL?? ?? ?? ? ?? ??? ?? ??? ???? ??
- ?? 3.1 ??? ?? ? ??
? signal(??) ?? ??, ?(wire)?? ?? signal a, b, c bit -- signal ?? c lt a and b -- ?(??) ?? ? variable(??)????,process ???? ?? variable temp bit -- variable?? temp a or b -- ?(??) ?? ? constant(??) ??? ??? ?? ?? ???? ??? ?? constant p1 integer 314 -- ????? ??? ??? ??
3?1? ??(object)? ??(statement)
?3? ??? ??? ? ???
- ? ??(signal)
- ? ??? VHDL??? ?(wire)?? ????, ? ??? ??? ????
- ????.
- ? ??? ?? ??
- ? lt? ????? ???? ???? ?????? ????? ??.
- ? signal? ??? ??? ??? ?? ?? ?? ??.
- ? ???? ??
- ? bit ??? ???? 0 ?? 1? ? ????? ??
- ? bit_vector ????? ??, ??? ??? ???? ????
- (downto) ?? ????(to)? ??
-
?? 3.1?? ??? ??? ??
4?1? ??(object)? ??(statement)
?3? ??? ??? ? ???
- ?? 3.2 ???? bit? signal? ??
- signal a, b, c bit
- -- a, b, c? ??? ??
- -- a, b, c? ?? ??? signal???
?(wire)?? ???? - -- a, b, c? ???? bit???? 1', '0'? ?
?? ?? ?? - ?? 3.3 signal? ??
-
- ltVHDL ??gt
- 1 entity combi_logic is
- 2 port ( a, b in bit
- 3 z, y out bit)
- 4 end combi_logic
- 5 architecture data_flow of combi_logic
is - 6 signal s1, s2 bit --
architecture? begin??? ?? - 7 begin
- 8 s1 lt a -- ?? a?
s1?? ?? - 9 s2 lt b -- ?? b?
s2? ?? - 10 z lt s1 or s2 -- "s1 or s2"?
z? ??
?? 3.2 ??? ??????
5?1? ??(object)? ??(statement)
?3? ??? ??? ? ???
- ?? 3.4 signal? ??(??? bit_vector)
- 1 signal count bit_vector (3 downto 0)
- -- signal count(3), count(2),
count(1), count(0) bit? ??? ?? - -- count? 4 ?? bus? ??
- 2 signal temp bit_vector (3 downto 0)
"1100" - -- temp? 4 ?? bus? ???? ??? ??
- ?? 3.5 signal ??? ??
- ltVHDL ??gt
- 1 entity combi_system is
- 2 port ( x1, x2, x3 in bit -- signal
x1, x2, x3 ?? - 3 y_out out bit ) --
signal y_out ?? - 4 end combi_system
- 5 architecture example of combi_system is
- 6 signal s0 bit -- signal s0
??, signal ???? - -- architecture?
begin?? - 7 begin
- 8 s0 lt x1 nand x2 -- signal? ?? ??
?? 3.3 ??? ???? system
6?1? ??(object)? ??(statement)
?3? ??? ??? ? ???
- ? ??(variable)
- process? ???????? ???? ?????? ??????? ?? ??,
???? ?? - ???? ??
- ?? 3.6 ?? ????
- variable temp1, temp2bit --
variable_??? temp1, temp2? ??, ???? bit - temp1 '1' --
? ?? ?? ?? - temp2 a or b -- a,
b ? signal??, temp2? variable - ?? 3.7 3?? NAND ???
- ltVHDL ??gt
- 1 architecture example of nand_system is
- 2 begin
- 3 process (x, y, z)
- 4 variable temp bit -- variable
??, variable ?? process? begin?? - 5 begin
- 6 temp '1'
-- temp? ?? 1? ?? - 7 temp x nand temp
-- variable? ?? ??, tempx - 8 temp y nand temp --
tempx y
?? 3.4 ??? nand_system
7?1? ??(object)? ??(statement)
?3? ??? ??? ? ???
- ? ??(signal)? ??(variable)? ??
- ? ??(signal)
- ? ?? ??
- ? ?? architecture? begin ???? ??, ??????? ??,
- port signal?? ??
- ? ??? wire? ????, ??? ??? ??? ??? ? ??
- ? signal? ?(??)? ??? ? ??? ??? ?? ?? ????
- ?? process? ?? ??? ??
- ? ??(variable)
- ? ?? ??
- ? ?? process? begin ???? ??,??????
parameter?? - ??
- ? ??? ?(wire)? ?? ???? ?? ??? ????? ??
- ? ??? ????? ??? ????, ??? ?? ??
- ? process? subprogram???? ??, ? ??? ????
variable - ?? ??
8?1? ??(object)? ??(statement)
?3? ??? ??? ? ???
- ?? 3.8signal? variable? ??? ???
-
- ? signal? ?? ??? ?
- ltVHDL??gt
- 1 architecture example1 of nand2_system is
- 2 signal temp bit -- signal ??
(architecture? begin??) - 3 begin
- 4 process (x, y)
- 5 begin
- 6 temp lt '1' -- ? ?????
temp '0', end process?? temp '1' - 7 temp lt x nand temp -- end
process?? temp 1' - 8 temp lt y nand temp -- end
process?? temp 1' - 9 z_out lt temp
-- end process?? z_out 1' - 10 end process
?? 3.5 ? ?? AND???(entity nand2_system)
9?1? ??(object)? ??(statement)
?3? ??? ??? ? ???
- ? variable? ??? ?? ??
- ltVHDL ??gt
- 1 architecture example2 of nand2_system is
- 2 begin
- 3 process (x, y)
- 4 variable temp bit --
variable?? (process? begin??) - 5 begin
- 6 temp '1'
-- temp? ?? '1'? ?? - 7 temp x nand temp -- temp
(x1)' - 8 temp y nand temp -- temp
(xy)' - 9 z_out lt temp --
z_out (xy)' - 10 end process
- 11 end example2
10?1? ??(object)? ??(statement)
?3? ??? ??? ? ???
- ?? 3.9 ????(full adder) ??
-
- 1 entity full_adder is
- 2 port ( a, b, c_in in bit
- 3 sum, c_out out bit )
- 4 end full_adder
- 5 architecture example of full_adder is
- 6 begin
- 7 process (a, b, c_in)
- 8 variable temp_sum1,temp_c1,temp_c2,temp
_c3 bit --?? variable? ?? - 9 begin
- 10 temp_sum1 a xor
b -- ?? ?? - 11 sum lt c_in xor
temp_sum1 - 12 temp_c1 a and
b -- ?? ?? - 13 temp_c2 a and
c_in -- ?? ??
?? 3.6 ??? full_adder
11?1? ??(object)? ??(statement)
?3? ??? ??? ? ???
- ? ??(constant)
- ??? ??? ??? ?? ????? ????, ??? ?? ??
- ?? 3.1 ??? ?? ??
- constant ??_?? ??? ??? --?????
??? - ?? 3.10 ??? ??
- constant delay time 5ns --
constant ?? - constant size integer 516 --
constant ??, ??? - ? ??(statements)
- ? VHDL? ?? ??
- ? ???(declaration statement)
- ????? ??? ? ?? ??, ???, ??, ????? ??
- ????? ??
- ? ??(constants) ???(literal) ??,
???(strings) - ? ???(types) ???(records) ??(array)
- ? ??(objects) ??(signal), ??(variable),
??(component) - ? ????? ??(function), ????(procedure)
-
12?1? ??(object)? ??(statement)
?3? ??? ??? ? ???
- ? ???(concurrent statement)
- ? ??? ?? ??? ??? ??, ????? ???? ?? ???
- ????? ??, ???? ??? ??? ???? ??? ????
- ??
- ? ???? ??
- ? ?????(process statement)
- ? ???(block statement)
- ? ???? ???(procedure call statement)
- ? ?? ???(component instantiation)
- ? ???(generate statement)
- ?? 3.11 ???? ??
- 1 architecture data_flow of concurr_ent is
- 2 signal a, b bit --a, b? ???
?? - 3 begin
- 4 a lt in3 and in4 -- and ??
- 5 b lt in5 or in6 -- or ??
- 6 out1 lt in1 xor a -- xor? ?? ??
- 7 out2 lt in2 xor b -- xor? ?? ??
- 8 end data_flow
13?1? ??(object)? ??(statement)
?3? ??? ??? ? ???
- ? ???(sequential statement)
- ???? ??? ???? ????, ????(process)?, ????? ???
?? - ? ???? ??
- ? ?? ???(variable assignment statement)
- ? ?? ???(signal assignment statement)
- ? ????? ?? ??(procedure and function calls)
- ? if, case, loop, next, exit, return, wait?
- ?? 3.12 ???? ??
- 1 architecture data_flow of sequent_ial is
- 2 begin
- 3 process
- 4 begin
- 5 wait until clk
- 6 if (accelerator '1') then
- 7 case speed is
- 8 when stop gt speed lt
slow - 9 when slow gt speed lt
medium - 10 when medium gt speed lt
fast - 11 when fast gt speed lt
slow
14 ?2? ???(data types)
?3? ??? ??? ? ???
- ? ???? ??
- ? ???
- VHDL?? ??? ?? ???(data type)?? ???? ???? ????
? - ??, ?? ??? ??? ???? ??
- ?? 3.2 ?? ??? ???? ??
- signal x, y bit
- variable kk bit_vector (
3 downto 0) - constant ss boolean
- ? ? ?
- ??? ?? ??? ???
- ? ?? ??? VHDL? ???
- ? ??(boolean)? ? ?? ?? ????? ????? ????? ???
boolean?? ? - ? ??(bit)? bit?? ? ? 0? 1? ?? ????? ?????
?? ?? bit?? ?. - ? ??-_??(bit_vector)? bit_vector?? bit?? ???
????? ?? - ? ??(character)? ??? ????? ??? ?? ????( ) ??
????? ??. - ? ??(integer)? ???? ??? ??? ????? ??.
- ? natural ? natural?? ???? ?????? 0? ??? ?????
?? - ? positive? ???? ?????? ?? ?, 0? ??? ?? ?? ???
?? - ? ???(string)? ??? ??? ????, ???? ?? ?? ?????
??
15 ?2? ???(data types)
?3? ??? ??? ? ???
- ? ???? ??
- ? ????(scalar type), ???(composite type)
-
?? 3.7 ???? ??
16 ?2? ???(data types)
?3? ??? ??? ? ???
- ? ????(scalar type)
- ? ???(integer type)
- ? ?? ?? ?? ?? ?? ?? ???? ??
- ?? 3.13 ???? ??
- type byte is range -128 to 127
- type bit_position is range 14 downto 0
- ?? 3.14 ?? ??? ???
- type integer is range -2147483647 to
2147483647 -- integer? -
-- ?? ?? - ? ???(real type or floating point type)
- ? ??? ?? ?? ?? ?? ??
- ?? 3.15 ???? ?? ?
- type real is range -1.0E38 to
1.0E38 -- real? ?? ??? ? - type norm is range 0.0 to 1.0
17 ?2? ???(data types)
?3? ??? ??? ? ???
- ? ???(physical type)
- ??, ??, ?? ?? ????? ???? ?? ??, ???? ?? ?????
???? ?? - ?? 3.16 ??? ?? ??
- type resistance is range 1 to 1E10
- units
- ohm
-- ???? - Kohm 1000 ohm -- 2? ??
- Mohm 1000 Kohm
- end units
- ?? 3.17 ??? ?? ??
- type time is range -2147483647 to
2147483647 - units
- fs
-- femtosecond, ???? - ps 1000 fs
-- picosecond - ns 1000 ps --
nanosecond - end units
- ?? 3.18 ??? ????
- type length is range 1 to 1E10
- units
18 ?2? ???(data types)
?3? ??? ??? ? ???
- ? ???(enumeration type)
- ???? ?? ???? ??? ??? ??? ?? ?? ???? ??
-
- ?? 3.19 ???? ??
- type bit2 is ('0', '1')
- type bit4 is ('0', '1', 'X', 'Z')
- type color is (red, blue, yellow)
- type day is (sun, mon, tue, wed, thu,
fri, sat) -
- ?? 3.20 ?? ??? ???
- type boolean is (true, false) --
boolean? ?? ?? - type bit is ('0', '1')
-- bit? ?? ?? - ? ???(character type)
- ?? 3.21 ???? ??
- type character is (
- NUL, SOH, STX, '', '''', '!', '',
'', '' - '0', '1' '2' 'lt', '', 'A', 'B', '',
'_', 'a', 'b' - 'x', 'y', 'z', DEL)
19 ?2? ???(data types)
?3? ??? ??? ? ???
- ? ???(composite type)
- ?? ??? ?? ?? ????? ???(array type)? ????
- (record type)
- ? ???(array type)
-
- ?? 3.22 ??? ???
- type word is array(15 downto 0) of
bit -- ????? ?? - type byte is array(7 downto 0) of bit
- type mem is array(0 to 1023) of
bit -- ????? ?? -
- ?? 3.23 ???? ???
- type bit_vector is array(natural range
lt gt) of bit - type string is array(positive range lt
gt) of bit - ? ????(record type)
-
- ?? 3.24 ???? ??
- type inst_R is record -- ??
?? - nemonic string --
??(field)? ??
20 ?2? ???(data types)
?3? ??? ??? ? ???
- ? std_ulogic? std_logic ???
- ? std_ulogic? 9? ??, IEEE. std_logic_1164? ??
??? - ? std_logic? std_ulogic? subtype?? ??.
std_ulogic ???? resolved - ?? ??.
- ?? 3.3 std_ulogic? std_logic ???
- 1 ???? ?? ??? ??? ?, ? ??? ?? ?? ?? ? ???. ??
???? ?? ? ???? ????? - ??? ??? ???, ? ??? ?? 'U'? ?.
- 2 ??? ??? ???? ??? ? ???? ??? ??? '1'? ????,
???? '0'? ?????, ??? ??
type boolean is ( false, true ) type
bit is ( '0', '1' ) type std_ulogic is (
'U' -- uninitialized1
X' -- strong
unknown2
'0' -- strong logic 0
1 -- strong logic 1
Z'3 -- high
impedance
W' -- weak4 unknown
L' -- weak logic 0
H' -- weak logic
1 _ --
don't care ) subtype std_logic is
resolved std_ulogic
21 ?2? ???(data types)
?3? ??? ??? ? ???
- ? ???? ??
- ? ???(integer type)
- ???? ???? ?????? ?? ??? ??, ????? ?
- ???? ??? ??? ??.
- ? ???(bit type)
- ???? VHDL ?? ??? ????, ???? ????? ???
- ???, 3??, ???? ?? ??? ??? ??
- ? std_ulogic? std_ulogic_vector?
- ????(unknown), 3??(tristate) ?? ????? ????
??? - ? ????, ???? ??
- ? std_logic? std_logic_vector?
- ??? ??? ??? ??? ??, ?? ???? ??? ??
- ? IEEE 1076.3 unsigned? signed?
- ? ??(unsigned)?? ??? ?? 2??? ??, ??(signed)??
- ??? ???, 2? ??? ??
22 ?3? ???(operator)? ??(attribute)
?3? ??? ??? ? ???
- ? ???(operators)
- ? ?? ???(logic operators)
- ????? ???? ????, bit, boolean, bit_vector?
??. -
-
- ?? 3.25 ?????? ?? (bit_vector, bit, boolean)
- 1 architecture example of combi_logic is
- 2 signal w, x, y bit_vector (3 downto
0) - 3 signal a, b, c, d bit
? 3.1 ?? ???(AND ???)
?? 3.8 ?? ??? ???
23 ?3? ???(operator)? ??(attribute)
?3? ??? ??? ? ???
- ? ?? ???(relational operators)
- ????? ???? ????, ???? ???? ??.
- ?? 3.26 ?? ???? ??
- 1 variable num1 real 100.0
- 2 variable num2 bit_vector(7 downto 0)
('0','0','0','0','0','0') - 3 variable num3, num4 bit_vector(2 downto
0) - 4 num1 / 350.54 --
num1? 350.54? ?? ?? - 5 num1 100.0 --
num1? 100.0? ?? - 6 num2 / ('1','0','0','0','0','0') --
num2? ???? ?? ??
? 3.2 ?? ???? ??
24 ?3? ???(operator)? ??(attribute)
?3? ??? ??? ? ???
- ? ?? ???(arithmetic operators)
- ??? ?? ?? ???? ?? ????, ?? ???? ?? IEEE
- 1076.3? numeric_std ??? ??.
-
- ?? 3.27 ?? ???? ??
- 1 architecture arith of or2 is
- 2 begin
- 3 process(a,b)
- 4 begin
- 5 y1 lt ab -- a
??? b - 6 y2 lt a-b -- a
?? b - 7 y3 lt ab -- a
??? b - 8 y4 lt a mod b -- a? b?
?? ?? - 9 y5 lt a rem b -- a? b?
?? ??? - 10 y6 lt abs a -- a?
???
? 3.3 ?? ???? ??
25 ?3? ???(operator)? ??(attribute)
?3? ??? ??? ? ???
- ? ?? ???(shift operators)
- ?? ???? 1???? bit? ???? ???? ??.
-
-
? 3.4 ?? ???? ??
?? 3.9 ?? ??
26 ?3? ???(operator)? ??(attribute)
?3? ??? ??? ? ???
- ?? 3.28 ?? ???? ??
- variable sm5 bit_vector(3 downto 0)
('1','0','1','1') - sm5 sll 1 -- sm5? 1?? sll??
(0,1,1,0) - sm5 sll 3 -- sm5? 3?? sll??
(1,0,0,0) - sm5 sll -3 -- sm5? -3?? sll?? srl? 3??
? ?? ?? - sm5 srl 1 -- sm5? 1?? srl??
(0,1,0,1) - sm5 srl 3 -- sm5? 3?? srl??
(0,0,0,1) - sm5 sla 1 -- sm5? 1?? sla??
(0,1,1,1) - sm5 sla 3 -- sm5? 3?? sla??
(1,1,1,1) - sm5 sla -3 -- sm5? -3?? sla?? sra? 3???
?? ?? - sm5 sra 1 -- sm5? 1?? sra??
(1,1,0,1) - sm5 sra 3 -- sm5? 3?? sra??
(1,1,1,1) - sm5 rol 1 -- sm5? 1?? rol??
(0,1,1,1) - sm5 rol 3 -- sm5? 3?? rol??
(1,1,0,1) - sm5 rol -3 -- sm5? -3?? rol?? ror? 3??
? ?? ?? -
- sm5 ror 1 -- sm5? 1?? ror??
(1,1,0,1) - sm5 ror 3 -- sm5? 3?? ror??
(0,1,1,1)
27 ?3? ???(operator)? ??(attribute)
?3? ??? ??? ? ???
- ? ?? ???(concatenation operators)
- ?? ???? ??? ??? ??? 1?? ??? ???? ??? ?? ??
-
- ?? 3.29 ?? ???? ??
- 1 entity con is
- 2 port(A, B in unsigned(2 downto 0)
-- ?? A "100", ?? B "010"?? ?? - 3 Y out unsigned(14 downto 0))
-- ?? Y? 15bit - 4 end con
- 5 architecture cdma of con is
- 6 constant C unsigned(2 downto 0)
"001" -- C? ??? ????, 3bit "001" - 7 begin
- 8 process(A, B)
- 9 begin
- 10 Y lt A B C C "110" -- ???
???? 100, 010, 001, - 11 end process
-- 001, "110"? ????
? 3.5 ?? ???? ??
28 ?3? ???(operator)? ??(attribute)
?3? ??? ??? ? ???
- ? ?? ???(sign operators)
- ?? ???? ?? ?? ????? ??? ????? ????
- ????? ??
-
-
- ?? 3.30 ?? ???? ??
- 1 architecture pone of sign is
- 2 begin
- 3 process(A,B)
- 4 begin
- 5 Y1 lt A / (-B) -- ?? A? ??
B? ??? Y1? ???? - 6 Y2 lt (-A) (-B) -- ?? A? B?
??? Y2? ???? - 7 Y3 lt A (-B) -- ?? A?
?? B? ??? Y3? ???? - 8 end process
- 9 end pone
? 3.6 ?? ???? ??
29 ?3? ???(operator)? ??(attribute)
?3? ??? ??? ? ???
? 3.7 ???? ????
- ? ???? ????(operators priority)
-
- ? ???? ??(operating overloading)
- VHDL? ?? ??? ?? ?? ??? ?? ??? ??? ?????
- ???? ?? ??? ??? ? ???? ?????? ?.
- ?? 3.31 0, 1? ???? ??
- type bit is ('0','1')
- type multi_value_logic is ('0', '1',
'X') - ?? 3.32 ?? ? ???? ???? ??
- 1 function man(A, B bit) return
bit -- "man"? ????
30 ?3? ???(operator)? ??(attribute)
?3? ??? ??? ? ???
- ? ??(attribute)
- ???? ?? ???? ?? ??? ?? ???? ???, ????,
- ??? ? ?? ?? ?? ??? ??
- ?? 3.33 ?? ???? ??
- 1 type index is integer range 1 to 30
- 2 type state is (one, two, three, four)
- 3 subtype short_state is states range
two to four - 4 signal byte std_logic_vector(7
downto 0) - 5 signal clk bit
- lt??? ?gt
- ? ??left index'left 1 --
index? ?? ??? ? 1? ??? - ? ??low index'low 1 --
index? ?? ?? ? 1? ??? - ? ??high index'high 30 -- index?
?? ? ? 30? ??? - ? ??right state'right four --
state? ?? ???? ? four? ??? - ??length index'length 10 -- index?
??? 10? ??? - ? ??range byte'range (7 downto 0) --
byte? ???(7 downto 0)? ??? - ? ??event clk'event --
clk? event? ?? ? true' - ??? ?? signal att state
31 ?3? ???(operator)? ??(attribute)
?3? ??? ??? ? ???
- ? ????(resolution function)
- ? ??(resolving) ?? ?? ???? ?? ?? ??? ??? ???
- ?
- ? ????(resolution function) ??? ?? ???? ???
??? - ??? ??? ??? ??? ?? ?? ??(source)? ???? ??
- ??? ?? ???? ??
- ?? 3.34 ????? ??
- architecture comb_logic of resol is
- begin
- z lt x or y
- z lt x and y
- end comb_logic
-
(a)???? (b) ???? ??
3.10 ?? ????
32 ?3? ???(operator)? ??(attribute)
?3? ??? ??? ? ???
? 3.8 ????? ???
? 3.9 std_logic? ????? ?? ???