Table Of ContentTIC-TAC-TOE
a) player vs player
b) player vs computer
By :-
1) Abhinav golas – 2003cs50466
2) Shruti garg – 2003cs10189
Cycle No -1
INSTRUCTOR:-
Anant Vishnoi
1
DESIGN SPECIFICATIONS
Data Game diplay on
(from 8*8 matrix
keyboard) 4 16
TICTACTOE
Reset
( * or # from
keyboard)
Score display
On LED display
11
Functionality and User interface
Ticatactoe on 8*8 matrix consists of 9 blocks ( 3 rows and
3 columns).
a) PLAYER VS PLAYER
In the player vs player version two players turn by turn
enter the input from keyboard . Keyboard keys (1-9) map to
2
the 9 blocks of tictactoe . So in order to select an ith block
on tictactoe player has to press ith key on the keyboard.
Once the display on 8*8 gets updated , turn switches to the
next player.Moves of players are shown by / and \ on the
chosen block. In case one of the player wins or the game
gets draw, the 8*8 display and score on LED display get
refreshed automatically .
Pressing * or # at any point of time will restart the whole
game.
Condition for win –
A player wins the game when he completes a row or a
column or a diagnol on the tictactoe.
b) PLAYER VS COMPUTER
In the player vs computer player , a single person can play
the game vs an automated player . Here the automated
player has been designed with always win strategy i.e it
won’t ever allow the other player to win the game.
In both these versions, score on the LED display will
specify number of games won by each player and also
show which player is currently playing.
DATA PATH
3
i
Input 2 player machine
machine
STORE OF
GAME
board
8*8 MATRIX
INTERFACE
WIN
DECIDING
MACHINE
Output display
machine
SIX 7 SEGMENT
SEVEN
SEGMENT
INTERFACE
(SCORE
DISPLAY)
4
8*8
MATRIX
HIGH LEVEL DESCRIPTION
The datapath comprises of 7 modules
1) Input Machine
2) 2 – player machine
3) Board, turn and score segment
4) 8x8 output display machine
5) 7 – segment output machine
6) Winning machine
7) Computer player
The high level description of each of these is:-
Input machine
PLAYER VS PLAYER
The input machine gets the requisite data from the
keyboard and converts it into a 2-bit row select and a 2-bit
column select(required for chosing an appropriate block of
the tictactoe). It also ensures that the data is valid, i.e. the
column and row options chosen are within valid limits.
Refresh data signal send by overall control machine is
5
required as an enable to this input machine . It sends a
status signal called valid which basically tells that the
machine has received a valid input now and thus has done
its job.
PLAYER VS COMPUTER
In this ,the input machine takes input from keyboard or the
Computer player depending on whichever of them has the
current turn. So the two inputs are basically multiplexed
with the select coming from turn signal (described later).
Inputs:
• Col: 3 – bits, for the keyboard module
• Clock 15hz: 1 – bit, for keyboard module
• Clock 490hz: 1 – bit, for the keyboard module
• Refresh_data: 1 – bit, enable signal for the circuit
(control signal)
• Clock 16kHz: 1 – bit, for circuit
Outputs:
• X: 2 – bit, row select ( from keyboard or computer
player)
• Y: 2 – bit, column select (from keyboard or computer
player)
• Valid: 1 – bit, data ready output (status signal)
6
COMPUTER PLAYER
Our automated computer player has been designed in
VHDL with always winning strategy which is described as
follows:-
7
Board
Board basically is a store for tictactoe values.
The Board consists of a 3x3x2 register, i.e. we require a
3x3 set of boxes for the board, each of which is a 2 bit
register. 3*3 set of boxes is needed to store value(2 bit) in
each of the 9 boxes of tictactoe . So we have divided the
board into 3 columns, each of which is a 6 – bit register
with parallel – in – parallel – out. This is done by means of
D – flip flops. In addition there is also a T – flip flop which
contains the data as to whose turn is it.
The coding scheme for the 2 – bit register is as follows:-
00 – empty
01 – X (shown by / on 8*8)
10 – O (shown by \ on 8*8)
11 – invalid
Inputs:
• Data in: 6 – bits ( comes from the two player machine
which is described later)
• Column select: 3 – bits (coming from input machine)
• Board reset: 1 – bit resets the whole board( control
signal )
• Dav :- enable to the board (control signal)
• Clock: 1 -bit
Outputs:
8
• Column A,B,C: 6 – bits each
TURN LOGIC:-
It consists of a T flipflop which has enable coming from
done signal given by two player machine. Hence it toggles
the turn whenever input from first player has been fed by
the two player to the board.
9
2 – player machine
The 2 – player machine gets the row and column in which
to write from input machine and decides whether the
selected spot is empty or not. It then updates the requisite
column of the board with the appropriate data according to
the turn of the player.
Inputs:
• Dav: 1 – bit, control signal when the machine is to be
active
• X: 2 – bit, row select
• Turn – 1 bit will show which player is currently
playing 0 or X
• ColumnX: 6 – bit data
• Clock: 1 – bit
Outputs:
• BA,BB,BC: 2 – bits each, data to be fed into each row
of the specified column
• Done :- status signal which gets on when the machine
has done its work.
10
Description:1 TIC-TAC-TOE a) player vs player b) player vs computer By :- 1) Abhinav golas – 2003cs50466 2) Shruti garg – 2003cs10189 Cycle No -1 INSTRUCTOR:-