1. 문제 및 설명
A. 아래 표에 주어진 상태 할당 테이블을 이용하여 Y[0]와 z에 대한 로직을 구현하시오

2. 문제 풀이
A. State
- A: 000
- B: 001
- C: 010
- D: 011
- E: 100

4. 모듈 정의
module top_module (
input clk,
input [2:0] y,
input x,
output Y0,
output z
);
5. 답
module top_module (
input clk,
input [2:0] y,
input x,
output Y0,
output z
);
parameter A = 3'b000,B = 3'b001, C= 3'b010, D = 3'b011, E = 3'b100;
reg [2:0] next_state;
always@(*)
begin
case(y)
A: next_state = x?B:A;
B: next_state = x?E:B;
C: next_state = x?B:C;
D: next_state = x?C:B;
E: next_state = x?E:D;
default next_state = y;
endcase
z = (y==D)|(y==E);
Y0 = next_state[0];
end
endmodule
'Verilog > HDLbits' 카테고리의 다른 글
| [HDLBits] Exams/m2014 q6c (0) | 2026.05.17 |
|---|---|
| [HDLBits] Exams/m2014 q6b (0) | 2026.05.17 |
| [HDLBits] Exams/2014 q3bfsm (0) | 2026.05.17 |
| [HDLBits] Exams/2014 q3fsm (0) | 2026.05.17 |
| [HDLBits] Exams/ece241 2014 q5b (0) | 2026.05.10 |