Verilog HDL
2007/06/25 14:24
http://blog.naver.com/PostPrint.nhn?blogId=babojay&logNo=40039111521#
Chapter 6.
Dataflow Modeling
- ÀÛÀº ȸ·ÎÀÇ °æ¿ì´Â gateÀÇ ¼ö°¡ Á¦ÇÑÀûÀ̸ç Çϳª Çϳª gate instantiationÀ» ÇÏ°í ¿¬°áÀ» ÇÒ ¼ö Àֱ⠶§¹®¿¡ Gete-level modelingÀ¸·Îµµ ÃæºÐÇÏ´Ù. ´õ±¸³ª ±âÃÊÀûÀÎ µðÁöÅРȸ·Î Áö½Ä¸¸ ÀÖ´Ù¸é ¼³°è¹æ¹ýÀÌ ¸Å¿ì Á÷°üÀûÀÏ ¼ö ÀÖ´Ù. ÇÏÁö¸¸ ȸ·Î°¡ º¹ÀâÇØÁö°í gate¼ö°¡ ´Ã¾î³ª¸é¼ ´õ È¿À²ÀûÀÎ ¼³°è ¹æ¹ýÀÌ ÇÊ¿äÇÏ¿´´Ù. Dataflow modelingÀº ·¹Áö½ºÅÍ°£ µ¥ÀÌÅÍÀÇ À̵¿°ú ±× µ¥ÀÌÅÍÀÇ Ã³¸®¿¡ °üÇÏ¿© ±â¼úÇÏ´Â ¼³°è ¹æ¹ýÀÌ´Ù. ¿äÁò¿£ Logic synthesizerÀÇ ¹ßÀüÀ¸·Î Dataflow modelingÀ» ÀÚµ¿À¸·Î Gate-level modelingÀ¸·Î º¯È¯ÇØ ÁÖ¸é¼ Dataflow ModelingÀÌ ´õ¿í °¢±¤À» ¹Þ°í ÀÖ´Ù. ¼³°è°úÁ¤ÀÇ À¯¿¬ÇÔÀ» ±Ø´ëÈÇϱâ À§ÇÏ¿© Gate-level, Dataflow, Behavioral ¼³°è°³³äÀ» ¾Æ¿ì¸£´Â Verilog DescriptionÀÌ ´ë¼¼À̸ç, Dataflow¿Í BehavioralÀÇ Á¶ÇÕÀÎ RTL(Register Tansfer Level)¼³°è ¹æ¹ýÀÌ ÀϹÝȵǾú´Ù.
*Objectives
- assign(continuos
assignment)±¸¹® , assign ±¸¹®ÀÇ Á¦ÇÑ, Implicit assignment ±¸¹®
- Assignment
delay, Implicit assignment delay, Net declaration delay
- Expressions,
Operators, Operands
- Operator types - ¼öÇÐ, ³í¸®, °ü°è, µî°¡, bitwise,
reduction, shift, concatenation,
conditional
6.1 Continuous
Assignments
- Dataflow modeling¿¡¼ °¡Àå ±âº»ÀûÀÎ
±¸¹®ÀÌ´Ù.
- Continuous¶õ ¿¬¼ÓÀûÀÌ´Ù. ²÷±èÀÌ ¾ø´Ù¶ó´Â ¶æÀÌ´Ù. H/W¿¡¼´Â ¾î¶² ÀǹÌÀϱî? ½Ã°£¿¡ ´ëÇÑ ¿¬¼ÓÀÏ
°ÍÀÌ´Ù. ´Ù½Ã ¸»Çϸé assigning Áß¿¡ ÀúÀåÇÏ´Â °úÁ¤ÀÌ ¾ø´Ù´Â ¸»ÀÌ´Ù. register³ª latchÀÇ ±â´ÉÀÌ ¾ø´Â digital
ȸ·Î °³³ä¿¡¼´Â Á¶ÇÕȸ·Î(combinational)À̶ó°í ÇÏ¸é ºñ½ÁÇÒ °ÍÀÌ´Ù.
Syntax]
<continuous_assign>
::=
assign <drive_strength>?<delay>?
<list_of_assignment>;
- <drive_strength>?,
<delay>? ´Â
optionÀÌ´Ù.
- drive_strength´Â strength
level·Î ÁöÁ¤ÇØ ÁÙ ¼ö ÀÖÀ¸¸ç ±âº»°ªÀº strong1,
strong0ÀÌ´Ù.
- delay´Â ½Ã°£´ÜÀ§·Î ÁöÁ¤ÇØÁÙ ¼ö ÀÖ´Ù.
continuous assginmentÀÇ Æ¯Â¡À» Á¤¸®ÇÏ¸é ´ÙÀ½°ú °°´Ù.
1. assignÀÇ ¿ÞÂÊ¿¡ ¿Ã ¼ö ÀÖ´Â °ÍÀº netÀÌ´Ù. register´Â ¿Ã ¼ö
¾ø´Ù.
2. delay¸¦ Æ÷ÇÔÇÏ¿© ¿À¸¥ÂÊÀÇ º¯È°¡ °áÁ¤µÇ¾îÁü°ú µ¿½Ã¿¡
assignµÈ´Ù.
3. ¿À¸¥ÂÊ¿¡´Â net, register, function callµîÀÌ ¿Ã ¼ö
ÀÖ´Ù.
4. Delay¸¦ ÁöÁ¤ÇØ ÁÙ ¼ö ÀÖÀ¸¸ç, ÀÌ´Â gate delay¸¦ Á¤ÇÏ´Â °Í°ú À¯»çÇÏ´Ù.
Ex)
// out, i1, i2
´Â ¸ðµÎ net
assign out = i1 & i2;
// addr´Â 16-bit
vectorr net, addr1°ú addr2´Â 16-bit register
assign
addr[15:0] = addr1[15:0] ^ addr2[15:0];
// Concatenation.
c_out°ú sum[3:0]ÀÌ ÇÕÃÄÁ® 5-bit netÀ¸·Î °£ÁֵȴÙ.
assign {c_out,
sum[3:0]} = a[3:0] + b[3:0] + c_in;
6.1.1 Implicit Continuous Assignment
- ´ÙÀ½ÀÇ ¿¹Ã³·³ netÀ» ¼±¾ðÇÏ¸é¼ ¾Ï¹¬ÀûÀ¸·Î assignÀÌ ÀÌ·ç¾îÁö±âµµ ÇÑ´Ù.
Ex)
// º¸ÅëÀÇ
¿¹
wire out;
assign out = in1 &
in2;
// Implicit
Assign
wire out = in1 & in2;
6.2 Delays
6.2.1 Regular Assignment Delay
- assign
Å°¿öµå µÚ¿¡ time unitÀ¸·Î ¸í½ÃÇØÁØ´Ù.
- ¿À¸¥ÂÊÀÇ operandÀÇ º¯È°¡ »ý±æ¶§ delay¸¸ÅÀÇ ½Ã°£ÈÄ¿¡ ¼ö½ÄÀ»
Àç°è»êÇÏ¿© °á°ú¿¡ ¹Ý¿µÇÏ°Ô µÈ´Ù.
Ex)
assign #10
out = in1 & in2;
±×¸² 6.1 Delays
- 20 ¿¡¼ in1°ú in2°¡ 'H'·Î ¿Ã¶ó°¡°í ±× °á°ú°¡ 10µÚÀÎ 30¿¡
³ªÅ¸³´Ù.
- ¸¶Âù°¡Áö·Î 60¿¡ in1ÀÌ 'L'·Î ³»·Á¿À°í ±× °á°ú°¡ 70¿¡
³ªÅ¸³´Ù.
- 80¿¡ in1ÀÌ 'H'·Î ¿Ã¶ó°¬À¸³ª delay time 10ÀÌ
È帥 90¿¡ °á°ú¸¦ Àç°è»êÇÏ°Ô µÃ´Ù. ÇÏÁö¸¸ delay timeÀÌ 10ÀÌ µÇ±â Àü¿¡ 'L'·Î
³»·Á°¬±â ¶§¹®¿¡ 90¿¡¼ Àç°è»ê °á°ú´Â 'L'ÀÌ µÈ´Ù.
- ÀÌ·± ÀÌÀ¯·Î
inertial delay(°ü¼º µô·¹ÀÌ)¶ó°íµµ ÇÑ´Ù.
6.2.2 Implicit Continuous Assignment Delay
Ex)
// Implicit
delay
wire #10 out = in1 & in2;
6.2.3 Net Declaration Delay
- Net¸¦ ¼±¾ðÇÒ ¶§ ±× net¿¡ delay¸¦ ÁöÁ¤ÇÒ ¼ö ÀÖ´Ù.
Ex)
// Net
Delay
wire #10 out;
assign out = in1
& in2;
6.3 Expressions, Operators and Operands
6.3.1 Expressions
- ÇÇ¿¬»êÀÚ¿Í ¿¬»êÀÚ·Î ÀÌ·ç¾îÁ® °á°ú¸¦ °®´Â ÀÏÁ¾ÀÇ
¼ö½Ä.
Ex)
//
Expressions
a ^ b
addr1[20:17] +
addr2[20:17]
in1 | in2
6.3.2 Operands
- Constant, integer, real number,
net, register, times, bit-select, part-selectµî °ÅÀÇ ¸ðµç data type°ú memory, function
callµµ °¡´ÉÇÏ´Ù.
Ex)
//
Operands
integer count, final_count
final_count = count + 1; // count : integer operand, 1 :
constant operand
real a, b,
c;
c = a -
b; // a, b : real
operand
reg [15:0] reg1,
reg2;
reg [3:0] reg_out;
reg_out =
reg1[3:0] ^ reg2[3:0]; // reg1[3:0], reg2[3:0]: part-select operand
reg
ret_value;
ret_value = calculate_parity(A,
B); // function call(calculate_parity) operand
6.4 Operator Types
Ç¥ 6.1 Operator types
6.4.1 Arithmetic Operators
- Binary operator : 2°³ÀÇ
operand¸¦ °¡Áö´Â operator
Ex)
A * B //
°öÇϱâ.
D / E //
³ª´©±â
A + B // ´õÇϱâ
B
- A // »©±â.
D % E //
³ª¸ÓÁö. (modulus)
in1 = 4'b101x; in2 =
4'b1010;
sum = in1 + in2; // sum :
4'bx
13 % 3 //
modulus operator(³ª¸ÓÁö) °á°ú´Â 1
-7 % 2 //
-1
7 % 2 // 1
- Unary operator : operand¾Õ¿¡ ºÙ´Â +, -
Ex)
-4 // negative 4
+5 // positive 5
-10 /
5 // °á°ú´Â -2
-'d10 /
5 // °á°ú´Â Á¤È®ÇÏÁö ¾ÊÀ¸¸ç ¿¹ÃøÇÒ ¼ö ¾ø°Ô
µÈ´Ù.
// -'d10 -> 2'comp of 10 -> 2^32 - 10
6.4.2 Logical Operators
- and(&&), or(||), not(!): &&, || ´Â binary, ! ´Â
unaryÀÌ´Ù.
- ¿¬»êÀÇ °á°ú´Â Ç×»ó 1-bitÀÇ true(1),
false(0), x ·Î
³ªÅ¸³´Ù.
- ¿¬»êÀÇ °á°ú°¡ 0 À̸é false, 0ÀÌ
¾Æ´Ï¸é true°¡ µÇÁö¸¸, operandÁß ¾î´ÀÇϳª¶óµµ x³ª z¸¦
°®°í ÀÖ´Ù¸é °á°ú´Â x°¡ µÈ´Ù.
Ex)
// Logical
operation
A = 3; B = 0;
A &&
B // (true AND false)ÀÇ °ü°èÀ̹ǷΠ°á°ú´Â
false(0)ÀÌ´Ù.
A || B // (true OR
false)ÀÇ °ü°èÀ̹ǷΠ°á°ú´Â true(1)ÀÌ´Ù.
!A // NOT(true)À̹ǷΠ°á°ú´Â
false(0)ÀÌ´Ù.
!B
// NOT(false)À̹ǷΠ°á°ú´Â true(1)ÀÌ´Ù.
A = 2'b0x; B =
2"b10;
A && B
// (x AND true)À̹ǷΠ°á°ú´Â x
(a == 2) && (b == 3) // a=2, b=3ÀÎ °æ¿ì¿¡¸¸ true(1), ±× ÀÌ¿Ü´Â false(0)
6.4.3 Relation operator
- Å©°í( >) ÀÛ°í(<) Å©°Å³ª °°°í(>=) À۰ųª °°°í(<=)ÀÇ °ü°è¸¦ ±¸ÇÑ´Ù.
OperandÁß¿¡ x³ªz°¡ Á¸ÀçÇÏ¸é ±×
¼ö½ÄÀÇ °á°ú´Â x°¡ µÈ´Ù.
Ex)
// A = 4, B =
3
// S = 4'b1010, T = 4'b1101, U = 4'b1xxx
A <=
B // °á°ú´Â 0
A >
B // °á°ú´Â 1
T
>= S // °á°ú´Â 1
T <
U // °á°ú´Â x
6.4.4 Equality Operator
- Logical equality(==, !=)¿Í case equality(===, !==)ÀÇ µÎ°¡Áö°¡
Á¸ÀçÇÑ´Ù.
- Logical equality´Â ³í¸® ¿¬»êÀÇ °á°ú¸¦ µûÁø´Ù. Áï, operand¿¡ x,
z°¡ Á¸ÀçÇÏ¸é °á°ú´Â x°¡ µÈ´Ù.
- Case equality´Â ³í¸® ¿¬»ê°ú´Â
¹«°üÇÏ°Ô operand°¡ ¹«½¼ °ªÀ̵ç ÀÏ´ëÀÏ·Î µ¿ÀÏÇÑÁöÀÇ ¿©ºÎ¸¸ µûÁø´Ù.
Ex)
// A = 4, B =
3
// J = 4'b1010, K = 4'b1101
// S =
4'b1xxz, T = 4'b1xxz, U = 4'b1xxx
A ==
B // false
J !=
K // true
J ==
S // x(unknown)
S ===
T // true
T !== U //
true
6.4.5 Bitwise Operators
- bit´ÜÀ§ÀÇ ³í¸®
¿¬»êÀÌ´Ù.
- operandÀÇ bit¼ö°¡ ´Ù¸¥ °æ¿ì ÀÛÀº bit¼öÀÇ MSBÂÊÀ¸·Î 0ÀÌ Ã¤¿ö Å« ÂÊ°ú °°°Ô ¸¸µç´Ù.
- ¿¬»êÀÇ °á°ú´Â bit¿¡¸¸ ÇÑÁ¤µÇ¸ç ´Ù¸¥ bit¿¡
¿µÇâÀ» ÁÖÁö ¾Ê´Â´Ù.
Ex)
// A =
4'b1010, B = 4'b1101, C = 4'b10x1
~A //
4'b0101
A & B //
4'b1000
A | B //
4'b1111
A ^ B //
4'b0111
A ^~ B //
4'b1000
A & C //
4'b10x0
6.4.6 Reduction Operators
- ÇϳªÀÇ operand³»ÀÇ bitµé°úÀÇ ³í¸®¿¬»êÀ¸·Î °á°ú´Â 1-bitÀÌ´Ù.
- &, ~&, |,
~|, ^, ~^(^~) µîbinary operatorÀÌÁö¸¸ »ç¿ë¹ýÀº unary
operatorÀÌ´Ù.
Ex)
// A =
4'b1010
&A // 1 & 0 & 1 & 0 ->
1'b0
|A // 1 | 0 | 1 | 0
-> 1'b1
^A // 1 ^ 0 ^ 1 ^
0 -> 1'b0
6.4.7 Shift Operators
- ¿À¸¥ÂÊÀ̳ª ¿ÞÂÊÀ¸·Î ¸í½ÃÇÑ ¸¸Å bit¸¦ ¿Å±â´Â ¿¬»êÀÚ
- ¿Å±â¸é¼ »ý±â´Â ºó ÀÚ¸®´Â 0À¸·Î
ä¿öÁø´Ù.
Ex)
// A =
4'b1100
Y = A >>
1; // 4'b0110
Y = A <<
1; // 4'b1000
Y = A <<
2; // 4'b0000
6.4.8 Concatenation Operator
- size°¡ ¸í½ÃµÈ operand¸¸
»ç¿ë °¡´ÉÇÏ´Ù.
- net, reg, vector, bit-select, part-select, sized constantµîÀ»
Çϳª·Î ¿¬°áÇÏ´Â ¿¬»êÀÚ ( {, }
)
Ex)
// A = 1'b1, B
= 2'b00, C = 2'b10, D = 3'b110
Y = {B,
C};
// Y = 4'b0010
Y = {A, B, C, D,
3'b001}; // Y = 11'b1_00_10_110_001
Y =
{A, B[0], C[1]}; //
Y = 3'b101
6.4.9 Replication Operator
- ConcatenationÀÇ
operand¸¦ ¸î ¹ø ¹Ýº¹Çؼ ³ÖÀ» °ÍÀΰ¡ ÁöÁ¤ÇÏ´Â ¿¬»êÀÚ
Ex)
reg
A;
reg [1:0] B, C;
reg [2:0]
D;
A = 1'b1; B = 2'b00: C = 2'b10; D = 3'b110;
Y = { 4{A}
};
// Y = 4'b1111
Y = { 4{A}, 2{B}
}; // Y =
8'b11110000
Y = { 4{A}, 2{B}, C }; // Y
= 11'b11110000110
6.4.10 Conditional Operator
- Condition_expr ? true_expr :
false_expr;
- Condition_expr¸¦ ¸éÀú
°è»êÇÏ°í ±× °á°ú°¡ trueÀ̸é true_expr°¡ ½ÇÇàµÇ°í, falseÀ̸é false_expr°¡ ½ÇÇàµÈ´Ù.
- Condition_expr°¡ xÀÏ °æ¿ì, true_expr, false_expr¸ðµÎ °è»êÇÏ¿©
°á°ú¸¦ bit´ÜÀ§·Î ºñ±³ÇÑ´Ù. °°À¸¸é ±× °ªÀ¸·Î, ´Ù¸£¸é x·Î °áÁ¤µÈ´Ù.
-
true_expr, false_expr´Â
°¢°¢ conditional operationÀÌ µé¾î°¥ ¼ö ÀÖ´Ù. Áï nestingÀÌ Çã¿ëµÈ´Ù.
Ex)
// modeling
tristate buffer
assign addr_bus = drive_enable ? addr_out
: 36'bz;
// modeling 2-to-1
mux
assign out = control ? in1 : in0;
//
nesting
assign out = (A == 3) ? (control ? x : y) :
(control ? m : n);
6.4.11 Operator Precedence
- °¢ ¿¬»êÀÚµéÀÇ ¿ì¼±¼øÀ§´Â ´ÙÀ½°ú °°´Ù.
- Äڵ带 Àб⠽±°Ô Çϱâ À§ÇØ °ýÈ£¸¦ ÀûÀýÈ÷ »ç¿ëÇÏ¿© ÁÖ´Â °ÍÀÌ
ÁÁ´Ù.
Ç¥ 6.2 Operator Precedence
6.4 Examples
- Àü¿¡ ´Ù·ç¾ú´ø 4-to-1 multiplexer¿Í 4-bit full adder¸¦ dataflow¸¦ ÀÌ¿ëÇÏ¿© modelingÇÏ¿© º»´Ù.
6.5.1 4-to-1 Multiplexer
- Method 1: Logic Equation
Ex)
// 4-to-1
Multiplexer with Dataflow, Logic Equation
module mux4_to_1
(out, i0, i1, i2, i3, s1, s0);
output
out;
input i0, i1, i2, i3;
input s1,
s0;
// Logic equation for
out
assign out = (~s1 & ~s0 & i0)
|
(~s1 & s0 & i1)
|
(s1 & ~s0 & i2)
|
(s1 & s0 & i3);
endmodule
- Method 2: Conditional Operator
Ex)
// 4-to-1
Multiplexer with Dataflow, Conditional Operator
module
mux4to1( out, i0, i1, i2, i3, s1, s0);
output
out;
input i0, i1, i2, i3;
input s1,
s0;
// Nested conditional
operator
assign out = s1 ? (s0 ? i3 : i2) : (s0 ? i1 :
i0);
endmodule
- Âü°í·Î Chapter 5¿¡¼ gate-level·Î modeling Çß´ø ¿¹Á¦¸¦ ºñ±³Çغ»´Ù.
Ex)
// 4-to-1 MUX
in Gate-level description
module mux4_to_1(out, i0, i1,
i2, i3, s1, s0);
output
out;
// Port declaration
input i0, i1, i2,
i3;
input s1, s0;
wire s1n,
s0n;
// Internal wire
wire y0, y1, y2, y3;
not (s1n,
s1);
// create s1n, s0n
not (s0n, s0);
and (y0, i0, s1n,
s0n); // 3-input and gate
and (y1,
i1, s1n, s0);
and (y2, i2, s1, s0n);
and (y3, i3, s1, s0);
or (out, y0, y1, y2, y3); // 4-input or gate
endmodule
6.5.2 4-bit Full Adder
- Method 1: Dataflow Operator
Ex)
// 4-bit Full
Adder with dataflow statement
module fulladd4 (sum, c_out,
a, b, c_in);
output [3:0]
sum;
output c_out;
input [3:0] a,
b;
input c_in;
assign {c_out, sum} = a + b + c_in;
endmodule
- Method 2: full addder with carry lookahead
Ex)
module
fulladd4 (sum, c_out, a, b, c_in);
output [3:0]
sum;
output c_out;
input [3:0] a,
b;
input c_in;
wire p0, g0, p1, g1,
p2, g2, p3, g3;
wire c4, c3, c2, c1;
assign p0 = a[0] ^
b[0],
p1 = a[1] ^
b[1],
p2 = a[2] ^
b[2],
p3 = a[3] ^ b[3];
assign g0 = a[0]
&
b[0],
g1 = a[1] &
b[1],
g2 = a[2] &
b[2],
g3 = a[3] & b[3];
assign c1 = g0 | (p0
&
c_in),
c2 = g1 | (p1 & g0) | (p1 & p0 &
c_in),
c3 = g2 | (p2 & g1) | (p2 & p1 & g0) | (p2 & p1 & p2 &
c_in),
c4 = g3 | (p3 & g2) | (P2 & p2 & g1) | (p3 & p2 & p1 &
g0) |
(p3 & p2 & p1 & p0 & c_in);
assign sum[0] = p0 ^
c_in,
sum[1] = p1 ^
c1,
sum[2] = p2 ^
c2,
sum[3] = p3 ^ c3;
assign c_out = c4;
endmodule
* 4 ´Ü°èÀÇ gate¸¦ °ÅÄ¡¸é¼ propagation delay°¡ ÀÏÁ¤ÇÏ°Ô µÈ´Ù.
**
logic Àº º¹ÀâÇØÁöÁö¸¸ bit¼ö°¡ ´Ã¾î³ª´õ¶óµµ propagation delay´Â ´Ã¾î³ªÁö ¾Ê´Â´Ù.
6.5.3 Ripple Counter
- Àü¿¡ ´Ù·ç¾ú´ø 4-bit ripple counter¸¦ dataflowÀÇ ±¸¹®À¸·Î modeling Çغ»´Ù.
±×¸² 6.2 4-bit Ripple Carry Counter
±×¸² 6.3 T-flipflop
±×¸² 6.4 Negative Edge Triggered D-F/F
Ex)
// 4-bit
Ripple Counter
module counter (Q, clock,
clear);
output [3:0]
q;
input clock, clear;
T_FF tff0 (q[0],
clock, clear);
T_FF tff1 (q[1], q[0],
clear);
T_FF tff2 (q[2], q[1],
clear);
T_FF tff3 (q[3], q[2], clear);
endmodule
// Edge-triggered
T-F/F
module T_FF (q, clk, clear);
output
q;
input clk, clear;
edge_dff ff1(q, , ~q,
clk, clear); // instantiation of
edge_dff
// complement of q is fed back to
d
// qbar is not connected
endmodule
// Edge-triggered
D-F/F
module edge_dff (q, qbar, d, clk, clear);
output q,
qbar;
input d, clk, clear;
wire s, sbar, r, rbar, cbar;
assign cbar =
~clear;
assign sbar = ~(rbar &
s),
s = ~(sbar & cbar &
~clk),
r = ~(rbar & ~clk,
s),
rbar = ~(r & cbar & d);
assign q = ~(s &
qbar),
qbar = ~(q & r & cbar);
endmodule
- Stimulus block
Ex)
// Top level
stimulus module
module stimulus;
reg CLOCK,
CLEAR;
wire [3:0] Q;
initial
$monitor($time, " Count Q
= %b, Clear = %b", Q[3:0], CLEAR);
counter c1(Q, CLOCK, CLEAR);
initial
begin
CLEAR =
1'b1;
#34 CLEAR =
1b0;
#200 CLEAR =
1'b1;
#50 CLEAR =
1'b0;
end
initial
begin
CLOCK =
1'b0;
forever #10 CLOCK =
~CLOCK;
end
initial
begin
#400
$finish;
end
endmodule
- ½Ã¹Ä·¹ÀÌ¼Ç °á°ú
0
Count Q = 0000, Clear = 1
34 Count Q = 0000, Clear = 0
40 Count Q = 0001, Clear =
0
60 Count Q = 0010, Clear
= 0
80 Count Q = 0011,
Clear = 0
100 Count Q = 0100,
Clear = 0
120 Count Q = 0101,
Clear = 0
140 Count Q = 0110,
Clear = 0
160 Count Q = 0111,
Clear = 0
180 Count Q = 1000,
Clear = 0
200 Count Q = 1001,
Clear = 0
220 Count Q = 1010,
Clear = 0
234 Count Q = 0000,
Clear = 1
284 Count Q = 0000,
Clear = 0
300 Count Q = 0001,
Clear = 0
320 Count Q = 0010,
Clear = 0
340 Count Q = 0011,
Clear = 0
360 Count Q = 0100,
Clear = 0
380 Count Q = 0101,
Clear = 0