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

Subversion Repositories axi_slave

[/] [axi_slave/] [trunk/] [src/] [base/] [axi_slave_addr_gen.v] - Blame information for rev 13

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 13 eyalhoc
<##//////////////////////////////////////////////////////////////////
2 2 eyalhoc
////                                                             ////
3
////  Author: Eyal Hochberg                                      ////
4
////          eyal@provartec.com                                 ////
5
////                                                             ////
6
////  Downloaded from: http://www.opencores.org                  ////
7
/////////////////////////////////////////////////////////////////////
8
////                                                             ////
9
//// Copyright (C) 2010 Provartec LTD                            ////
10
//// www.provartec.com                                           ////
11
//// info@provartec.com                                          ////
12
////                                                             ////
13
//// This source file may be used and distributed without        ////
14
//// restriction provided that this copyright statement is not   ////
15
//// removed from the file and that any derivative work contains ////
16
//// the original copyright notice and the associated disclaimer.////
17
////                                                             ////
18
//// This source file is free software; you can redistribute it  ////
19
//// and/or modify it under the terms of the GNU Lesser General  ////
20
//// Public License as published by the Free Software Foundation.////
21
////                                                             ////
22
//// This source is distributed in the hope that it will be      ////
23
//// useful, but WITHOUT ANY WARRANTY; without even the implied  ////
24
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR     ////
25
//// PURPOSE.  See the GNU Lesser General Public License for more////
26
//// details. http://www.gnu.org/licenses/lgpl.html              ////
27
////                                                             ////
28 13 eyalhoc
//////////////////////////////////////////////////////////////////##>
29 2 eyalhoc
 
30
OUTFILE PREFIX_addr_gen.v
31
 
32
INCLUDE def_axi_slave.txt
33
 
34
module PREFIX_addr_gen(PORTS);
35
 
36
   input                      clk;
37
   input                      reset;
38
 
39
   input [ADDR_BITS-1:0]      cmd_addr;
40 10 eyalhoc
   input [SIZE_BITS-1:0]           cmd_size;
41 2 eyalhoc
 
42
   input                      advance;
43
   input                      restart;
44
 
45
   output [ADDR_BITS-1:0]     ADDR;
46
 
47
 
48
   reg [ADDR_BITS-1:0]         offset;
49
   wire [3:0]                  size_bytes;
50
 
51 10 eyalhoc
   assign                     size_bytes =
52 2 eyalhoc
                              cmd_size == 2'b00 ? 4'd1 :
53
                              cmd_size == 2'b01 ? 4'd2 :
54
                              cmd_size == 2'b10 ? 4'd4 :
55
                              cmd_size == 2'b11 ? 4'd8 : 4'd0;
56
 
57
   always @(posedge clk or posedge reset)
58
     if (reset)
59
       offset <= #FFD {ADDR_BITS{1'b0}};
60
     else if (restart)
61
       offset <= #FFD {ADDR_BITS{1'b0}};
62
     else if (advance)
63
       offset <= #FFD offset + size_bytes;
64
 
65
   assign                     ADDR = cmd_addr + offset;
66
 
67
 
68
endmodule
69
 
70
 

powered by: WebSVN 2.1.0

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