1. 문제 및 설명
A. 이 문제는 앞선 문제에서 만들었던 FSM의 상태를 One-Hot Encoding 형식으로 수정 한 것입니다.
2. 요구사항
A. 논리식 도출: 원-핫 인코딩(S, S1, S11, S110, B0, B1, B2, B3, Count, Wait = 10'b0000000001, 10'b0000000010, ..., 10'b1000000000)을 사용한다고 가정하고, 상태 전이 논리식(next-state logic equations)과 출력 논리식(output logic equations)을 육안으로 관찰하여(by inspection) 도출하세요.
B. 구현: 이 상태 머신의 조합 논리 회로 부분(상태 전이 논리 및 출력 논리)만 구현하세요. (테스트벤치는 원-핫이 아닌 입력을 사용하여, 복잡한 우회 방식을 쓰지 않는지 확인할 것입니다.
3. 문제 풀이
A. state

4. 모듈 정의
module top_module(
input d,
input done_counting,
input ack,
input [9:0] state, // 10-bit one-hot current state
output B3_next,
output S_next,
output S1_next,
output Count_next,
output Wait_next,
output done,
output counting,
output shift_ena
);
5. 답
module top_module(
input d,
input done_counting,
input ack,
input [9:0] state, // 10-bit one-hot current state
output B3_next,
output S_next,
output S1_next,
output Count_next,
output Wait_next,
output done,
output counting,
output shift_ena
); //
// You may use these parameters to access state bits using e.g., state[B2] instead of state[6].
parameter S=0, S1=1, S11=2, S110=3, B0=4, B1=5, B2=6, B3=7, Count=8, Wait=9;
assign B3_next = state[B2];
assign S_next = ((!d)&(state[S1]|state[S]|state[S110]))|(ack&state[Wait]);
assign S1_next = d&(state[S]);
assign Count_next = state[B3]|(state[Count] & !done_counting);
assign Wait_next = (state[Count] & done_counting)|(state[Wait] & !ack);
assign counting = (state[Count]);
assign done = (state[Wait]);
assign shift_ena = (state[B0])|(state[B1])|(state[B2])|(state[B3]);
endmodule
'Verilog > HDLbits' 카테고리의 다른 글
| [HDLBits] Exams/review2015 fancytimer (0) | 2026.05.31 |
|---|---|
| [HDLBits] Exams/review2015 fsm (0) | 2026.05.31 |
| [HDLBits] Exams/review2015 shiftcount (0) | 2026.05.31 |
| [HDLBits] Exams/review2015 shiftcount (0) | 2026.05.31 |
| [HDLBits] Exams/review2015 shiftcount (0) | 2026.05.31 |