Tic-tac-toe X39419


Statement
 

pdf   zip   verilog

html

A Tic-tac-toe board can be represented by a binary matrix where the ones and zeros represent the × and ◯ marks, respectively. The following board represents a possible final configuration after playing the game.

||

101
110
001

||

We can represent the board with a 9-bit vector, with the indices of the vector representing the board locations as follows: ||

876
543
210

||

Thus, the previous board would be represented with the bit-vector 101110001. Note that a board may contain more than one row of ones and more than one row of zeros.

Design a circuit that receives a board description and generates two outputs. One output will be activated when there is at least one row of ones (vertical, horizontal or diagonal). The other output will be activated when there is at least one row of zeros.

Specification

module tictactoe(board, row1, row0); input [8:0] board; output row0, row1;

Hint Try to minimize the effort by reusing the design of some module in the same circuit.

Input

  • board is a 9-bit vector describing a Tic-tac-toe board.

Output

  • row1 is the output indicating whether there is a row of ones.
  • row0 is the output indicating whether there is a row of zeros.
Information
Author
Jordi Cortadella
Language
English
Official solutions
Unknown. This problem is being checked.
User solutions
Verilog