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

Subversion Repositories wb_dma

[/] [wb_dma/] [trunk/] [rtl/] [verilog/] [wb_dma_pri_enc_sub.v] - Blame information for rev 6

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

Line No. Rev Author Line
1 6 rudi
/////////////////////////////////////////////////////////////////////
2
////                                                             ////
3
////  WISHBONE DMA Priority Encoder Sub-Module                   ////
4
////                                                             ////
5
////                                                             ////
6
////  Author: Rudolf Usselmann                                   ////
7
////          rudi@asics.ws                                      ////
8
////                                                             ////
9
////                                                             ////
10
////  Downloaded from: http://www.opencores.org/cores/wb_dma/    ////
11
////                                                             ////
12
/////////////////////////////////////////////////////////////////////
13
////                                                             ////
14
//// Copyright (C) 2001 Rudolf Usselmann                         ////
15
////                    rudi@asics.ws                            ////
16
////                                                             ////
17
//// This source file may be used and distributed without        ////
18
//// restriction provided that this copyright statement is not   ////
19
//// removed from the file and that any derivative work contains ////
20
//// the original copyright notice and the associated disclaimer.////
21
////                                                             ////
22
////     THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY     ////
23
//// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED   ////
24
//// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS   ////
25
//// FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR      ////
26
//// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,         ////
27
//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES    ////
28
//// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE   ////
29
//// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR        ////
30
//// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF  ////
31
//// LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT  ////
32
//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT  ////
33
//// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE         ////
34
//// POSSIBILITY OF SUCH DAMAGE.                                 ////
35
////                                                             ////
36
/////////////////////////////////////////////////////////////////////
37
 
38
//  CVS Log
39
//
40
//  $Id: wb_dma_pri_enc_sub.v,v 1.1 2001-08-07 08:00:43 rudi Exp $
41
//
42
//  $Date: 2001-08-07 08:00:43 $
43
//  $Revision: 1.1 $
44
//  $Author: rudi $
45
//  $Locker:  $
46
//  $State: Exp $
47
//
48
// Change History:
49
//               $Log: not supported by cvs2svn $
50
//
51
//
52
//
53
//
54
//
55
 
56
`include "wb_dma_defines.v"
57
 
58
// Priority Encoder
59
//
60
// Determines the channel with the highest priority, also takes
61
// the valid bit in consideration
62
 
63
module wb_dma_pri_enc_sub(valid, pri_in, pri_out);
64
input           valid;
65
input   [2:0]    pri_in;
66
output  [7:0]    pri_out;
67
 
68
reg     [7:0]    pri_out;
69
 
70
`ifdef PRI_8
71
always @(valid or pri_in)
72
        if(!valid)              pri_out = 8'b0000_0001;
73
        else
74
        if(pri_in==3'h0)        pri_out = 8'b0000_0001;
75
        else
76
        if(pri_in==3'h1)        pri_out = 8'b0000_0010;
77
        else
78
        if(pri_in==3'h2)        pri_out = 8'b0000_0100;
79
        else
80
        if(pri_in==3'h3)        pri_out = 8'b0000_1000;
81
        else
82
        if(pri_in==3'h4)        pri_out = 8'b0001_0000;
83
        else
84
        if(pri_in==3'h5)        pri_out = 8'b0010_0000;
85
        else
86
        if(pri_in==3'h6)        pri_out = 8'b0100_0000;
87
        else                    pri_out = 8'b1000_0000;
88
`else
89
`ifdef PRI_4
90
always @(valid or pri_in)
91
        if(!valid)              pri_out = 8'b0000_0001;
92
        else
93
        if(pri_in==3'h0)        pri_out = 8'b0000_0001;
94
        else
95
        if(pri_in==3'h1)        pri_out = 8'b0000_0010;
96
        else
97
        if(pri_in==3'h2)        pri_out = 8'b0000_0100;
98
        else                    pri_out = 8'b0000_1000;
99
`else
100
always @(valid or pri_in)
101
        if(!valid)              pri_out = 8'b0000_0001;
102
        else
103
        if(pri_in==3'h0)        pri_out = 8'b0000_0001;
104
        else                    pri_out = 8'b0000_0010;
105
`endif
106
`endif
107
 
108
endmodule
109
 

powered by: WebSVN 2.1.0

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