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

Subversion Repositories othellogame

[/] [othellogame/] [trunk/] [rtl/] [RB_cnt.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:    23:44:58 05/05/2009 
7
// Design Name: 
8
// Module Name:    RB_cnt 
9
// Project Name: 
10
// Target Devices: 
11
// Tool versions: 
12
// Description: 
13
//
14
// Dependencies: 
15
//
16
// Revision: 
17
// Revision 0.01 - File Created
18
// Additional Comments: 
19
//
20
//////////////////////////////////////////////////////////////////////////////////
21
module RB_cnt(
22
                clk,
23
                RST,
24
                B,
25
                R,
26
                cntB,
27
                cntR
28
    );
29
 
30
input clk;
31
input RST;
32
input [63:0] B;
33
input [63:0] R;
34
output [6:0] cntB;
35
output [6:0] cntR;
36
 
37
reg [3:0] cntB_p00_d;
38
reg [3:0] cntB_p01_d;
39
reg [3:0] cntB_p02_d;
40
reg [3:0] cntB_p03_d;
41
reg [3:0] cntB_p04_d;
42
reg [3:0] cntB_p05_d;
43
reg [3:0] cntB_p06_d;
44
reg [3:0] cntB_p07_d;
45
 
46
reg [3:0] cntR_p00_d;
47
reg [3:0] cntR_p01_d;
48
reg [3:0] cntR_p02_d;
49
reg [3:0] cntR_p03_d;
50
reg [3:0] cntR_p04_d;
51
reg [3:0] cntR_p05_d;
52
reg [3:0] cntR_p06_d;
53
reg [3:0] cntR_p07_d;
54
 
55
reg [6:0] cntB_d;
56
reg [6:0] cntR_d;
57
 
58
reg [6:0] cntB_q;
59
reg [6:0] cntR_q;
60
 
61
wire [6:0] cntR;
62
wire [6:0] cntB;
63
 
64
assign cntB = cntB_q;
65
assign cntR = cntR_q;
66
 
67
always @( * ) begin
68
 
69
        cntB_p00_d = B[00] + B[01] + B[02] + B[03] + B[04] + B[05] + B[06] + B[07];
70
        cntB_p01_d = B[08] + B[09] + B[10] + B[11] + B[12] + B[13] + B[14] + B[15];
71
        cntB_p02_d = B[16] + B[17] + B[18] + B[19] + B[20] + B[21] + B[22] + B[23];
72
        cntB_p03_d = B[24] + B[25] + B[26] + B[27] + B[28] + B[29] + B[30] + B[31];
73
        cntB_p04_d = B[32] + B[33] + B[34] + B[35] + B[36] + B[37] + B[38] + B[39];
74
        cntB_p05_d = B[40] + B[41] + B[42] + B[43] + B[44] + B[45] + B[46] + B[47];
75
        cntB_p06_d = B[48] + B[49] + B[50] + B[51] + B[52] + B[53] + B[54] + B[55];
76
        cntB_p07_d = B[56] + B[57] + B[58] + B[59] + B[60] + B[61] + B[62] + B[63];
77
 
78
        cntB_d = cntB_p00_d + cntB_p01_d + cntB_p02_d + cntB_p03_d + cntB_p04_d + cntB_p05_d + cntB_p06_d + cntB_p07_d;
79
 
80
        cntR_p00_d = R[00] + R[01] + R[02] + R[03] + R[04] + R[05] + R[06] + R[07];
81
        cntR_p01_d = R[08] + R[09] + R[10] + R[11] + R[12] + R[13] + R[14] + R[15];
82
        cntR_p02_d = R[16] + R[17] + R[18] + R[19] + R[20] + R[21] + R[22] + R[23];
83
        cntR_p03_d = R[24] + R[25] + R[26] + R[27] + R[28] + R[29] + R[30] + R[31];
84
        cntR_p04_d = R[32] + R[33] + R[34] + R[35] + R[36] + R[37] + R[38] + R[39];
85
        cntR_p05_d = R[40] + R[41] + R[42] + R[43] + R[44] + R[45] + R[46] + R[47];
86
        cntR_p06_d = R[48] + R[49] + R[50] + R[51] + R[52] + R[53] + R[54] + R[55];
87
        cntR_p07_d = R[56] + R[57] + R[58] + R[59] + R[60] + R[61] + R[62] + R[63];
88
 
89
        cntR_d = cntR_p00_d + cntR_p01_d + cntR_p02_d + cntR_p03_d + cntR_p04_d + cntR_p05_d + cntR_p06_d + cntR_p07_d;
90
 
91
 
92
end
93
 
94
always @(posedge clk) begin
95
        if ( RST ) begin
96
                cntB_q <= 0;
97
                cntR_q <= 0;
98
        end
99
        else begin
100
                cntB_q <= cntB_d;
101
                cntR_q <= cntR_d;
102
        end
103
end
104
 
105
endmodule

powered by: WebSVN 2.1.0

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