OpenCores
URL https://opencores.org/ocsvn/othellogame/othellogame/trunk

Subversion Repositories othellogame

[/] [othellogame/] [trunk/] [rtl/] [move_cell.v] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 marius_mtm
`timescale 1ns / 1ps
2
//////////////////////////////////////////////////////////////////////////////////
3
// Company: 
4
// Engineer: 
5
// 
6
// Create Date:    21:20:38 04/05/2009 
7
// Design Name: 
8
// Module Name:    move_cell 
9
// Project Name:   The FPGA Othello Game
10
// Target Devices: 
11
// Tool versions: 
12
// Description: 
13
//     Represents a square from othello board
14
//     Inputs: r bit, b bit, pulse (1-when we want to put a disc on then square, 0-otherwise
15
//     Outputs: r bit, b bit (flipped if there is the case).  (forward and backwards signals
16
//              to carry away the info (like a ripple carry adder).
17
//
18
// Dependencies: -
19
//
20
// Revision: 
21
// Revision 0.01 - File Created
22
// Additional Comments: 
23
//
24
//  Marius TIVADAR Mar-Apr, 2009
25
//////////////////////////////////////////////////////////////////////////////////
26
module move_cell(
27
    input r,
28
    input b,
29
    input fw_in,
30
    input bw_in,
31
    output fw_out,
32
    output bw_out,
33
    input pulse,
34
    output r_out,
35
    output b_out
36
    );
37
 
38
reg r_out_reg;
39
reg b_out_reg;
40
 
41
 
42
always @( * ) begin
43
 
44
        /* if backward signal and forward signal, flip the discs.
45
      Otherwise, r,b bits remain the same       */
46
        if ( bw_in && fw_in ) begin
47
                b_out_reg = 1;
48
                r_out_reg = 0;
49
        end
50
        else begin
51
                b_out_reg = b;
52
                r_out_reg = r;
53
        end
54
end
55
 
56
/* equations for forward and backward signal propagation */
57
/* forward signal is 1 if we have an outside pulse, or we received fw signal from neighbour cell */
58
assign  fw_out = pulse || (r && fw_in);
59
/* backward signal is 1 if we received backward signal from neighbour cell, or if we flanc the disc (b bit is 1)
60
   and we propagate the bw signal */
61
assign  bw_out = bw_in || (b && fw_in);
62
 
63
assign  r_out = r_out_reg;
64
assign  b_out = b_out_reg;
65
 
66
endmodule

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.