function stateDecoder;
input [1:0] s;
case (s)
S0,S3 : stateDecoder=1'b0;
S1,S2 : stateDecoder=1'b1;
endcase
endfunction
assign z=stateDecoder(currentState);
|
現在の 状態 |
入力X |
つぎの状態 |
出力Z |
|
S0 |
00 |
S0 |
0 |
|
S0 |
01 |
S2 |
0 |
|
S0 |
1x |
S0 |
0 |
|
S1 |
00 |
S0 |
1 |
|
S1 |
01 |
S2 |
1 |
|
S1 |
1x |
S0 |
1 |
|
S2 |
00 |
S2 |
1 |
|
S2 |
01 |
S3 |
1 |
|
S2 |
1x |
S0 |
1 |
|
S3 |
00 |
S3 |
0 |
|
S3 |
01 |
S1 |
0 |
|
S3 |
1x |
S0 |
0 |
関数化せずに1行で記述してもよい
assign z=(currentState==S1)|(currentState==S2);