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

Subversion Repositories theia_gpu

[/] [theia_gpu/] [branches/] [icarus_version/] [rtl/] [Module_BusArbitrer.v] - Blame information for rev 169

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 158 diegovalve
`timescale 1ns / 1ps
2
`include "aDefinitions.v"
3
/**********************************************************************************
4
Theia, Ray Cast Programable graphic Processing Unit.
5
Copyright (C) 2010  Diego Valverde (diego.valverde.g@gmail.com)
6
 
7
This program is free software; you can redistribute it and/or
8
modify it under the terms of the GNU General Public License
9
as published by the Free Software Foundation; either version 2
10
of the License, or (at your option) any later version.
11
 
12
This program is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
GNU General Public License for more details.
16
 
17
You should have received a copy of the GNU General Public License
18
along with this program; if not, write to the Free Software
19
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
20
 
21
***********************************************************************************/
22
 
23
 
24
 
25
module Module_BusArbitrer
26
(
27
input wire Clock,
28
input wire Reset,
29
 
30
input wire [`MAX_CORES-1:0] iRequest,
31
output wire [`MAX_CORES-1:0] oGrant,
32
output wire [`MAX_CORE_BITS-1:0] oBusSelect
33
);
34
 
35
wire[`MAX_CORES-1:0] wCurrentMasterMask;
36
wire[`MAX_CORE_BITS-1:0] wCurrentBusMaster;
37
wire wCurrentRequest;
38
 
39
//Just one requester can have the bus at a given
40
//point in time, the mask makes sure this happens
41
genvar i;
42
generate
43
for (i = 0; i < `MAX_CORES; i = i +1)
44
begin : ARB
45
        assign oGrant[i] = iRequest[i] & wCurrentMasterMask[i];
46
end
47
endgenerate
48
 
49
 
50
 
51
//When a requester relinquishes the bus (by negating its [iRequest] signal),
52
//the switch is turned to the next position
53
//So while iRequest == 1 the ciruclar list will not move
54
 
55
CIRCULAR_SHIFTLEFT_POSEDGE_EX # (`MAX_CORES) SHL_A
56
(
57
 .Clock( Clock ),
58
 .Enable( ~wCurrentRequest ),
59
 .Reset( Reset ),
60
 .Initial(`MAX_CORES'b1),
61
 .O( wCurrentMasterMask )
62
 
63
);
64
 
65
assign oBusSelect = wCurrentBusMaster;
66
 
67
//Poll the current request
68
assign wCurrentRequest = iRequest[ wCurrentBusMaster ];
69
 
70
 
71
UPCOUNTER_POSEDGE # (`MAX_CORE_BITS ) UP1
72
(
73
        .Clock( Clock ),
74
        .Reset( Reset ),
75
        .Initial( `MAX_CORE_BITS'd0 ),
76
        .Enable(~wCurrentRequest),
77
        .Q(wCurrentBusMaster)
78
);
79
 
80
endmodule

powered by: WebSVN 2.1.0

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