tic tac toe

Hi to all,

A homework task I got is to implement a synchronous program
that checks a tic tac toe board, which is of n*n size.
The program detects if there's a winner ( Are all the elements in a row or column the same) and if so, who is the winner.

the information of the content of the board is given by "D_in":
00- blank cell; 01- X; 10- O; 11- end of line
The information is inserted in the shift-register method-
row by row ( left to right), and when a row ends there's 11/
end of the whole board is represented by "Rst_n" being '0'.

The output of the program is given by "Stts:
00- waiting; 01- X wins; 10- O wins; 11- draw

The general idea of the program is that there's a user ( whom controls
"D_in" and "Rst_n") which inserts the matrix row by row,
The end of a line is announced by D_in = "11" and
an end of the whole matrix is announced by Rst_n = '0';
In case there's a winner found during the check process
the output should stay the same till the end of the check
( only one winner is possible).
if theres no winner in the check process the output Stts
will by "11"

At first I want to check only it theres a winner by
checking the rows, and leave aside in the meantime the columns check.

In the testbench I need to check these 5 options:
1. O row wins 2. X row wins 3. O column wins
4. X column wins 5. draw

In the meantime I have advanced in the solution, but still theres some problems in the program.


At the first, second and last options the input is correct.
however in the rest there's a problem and the input is incorrect.
I assume the problem is somehow connected to the FSM,
and that for some reason the next state in the FSM is
depended on the current state.

any idea what's the problem?

I attached above the a capture of the wave-form of the simulated and synthesized program by modelsim and the program code.

Amitai

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories