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

Subversion Repositories ao486

[/] [ao486/] [trunk/] [rtl/] [ao486/] [memory/] [link_readburst.v] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 alfik
/*
2
 * Copyright (c) 2014, Aleksander Osman
3
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions are met:
7
 *
8
 * * Redistributions of source code must retain the above copyright notice, this
9
 *   list of conditions and the following disclaimer.
10
 *
11
 * * Redistributions in binary form must reproduce the above copyright notice,
12
 *   this list of conditions and the following disclaimer in the documentation
13
 *   and/or other materials provided with the distribution.
14
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
19
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22
 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 */
26
 
27
`include "defines.v"
28
 
29
//TYPE: full save
30
 
31
module link_readburst(
32
    input               clk,
33
    input               rst_n,
34
 
35
    // readburst REQ
36
    input               req_readburst_do,
37
    output              req_readburst_done,
38
 
39
    input       [31:0]  req_readburst_address,
40
    input       [1:0]   req_readburst_dword_length,
41
    input       [3:0]   req_readburst_byte_length,
42
    output      [95:0]  req_readburst_data,
43
 
44
    // readburst RESP
45
    output              resp_readburst_do,
46
    input               resp_readburst_done,
47
 
48
    output      [31:0]  resp_readburst_address,
49
    output      [1:0]   resp_readburst_dword_length,
50
    output      [3:0]   resp_readburst_byte_length,
51
    input       [95:0]  resp_readburst_data
52
);
53
 
54
//------------------------------------------------------------------------------
55
 
56
reg         current_do;
57
reg [31:0]  address;
58
reg [1:0]   dword_length;
59
reg [3:0]   byte_length;
60
 
61
//------------------------------------------------------------------------------
62
 
63
wire save;
64
 
65
//------------------------------------------------------------------------------
66
 
67
assign save  = req_readburst_do && ~(resp_readburst_done);
68
 
69
//------------------------------------------------------------------------------
70
 
71
always @(posedge clk or negedge rst_n) begin
72
    if(rst_n == 1'b0)               current_do <= `FALSE;
73
    else if(save)                   current_do <= req_readburst_do;
74
    else if(resp_readburst_done)    current_do <= `FALSE;
75
end
76
 
77
always @(posedge clk or negedge rst_n) begin if(rst_n == 1'b0) address      <= 32'd0; else if(save) address      <= req_readburst_address;      end
78
always @(posedge clk or negedge rst_n) begin if(rst_n == 1'b0) dword_length <= 2'd0;  else if(save) dword_length <= req_readburst_dword_length; end
79
always @(posedge clk or negedge rst_n) begin if(rst_n == 1'b0) byte_length  <= 4'd0;  else if(save) byte_length  <= req_readburst_byte_length;  end
80
 
81
//------------------------------------------------------------------------------
82
 
83
assign req_readburst_done = resp_readburst_done;
84
assign req_readburst_data = resp_readburst_data;
85
 
86
assign resp_readburst_do           = (req_readburst_do)? req_readburst_do           : current_do;
87
assign resp_readburst_address      = (req_readburst_do)? req_readburst_address      : address;
88
assign resp_readburst_dword_length = (req_readburst_do)? req_readburst_dword_length : dword_length;
89
assign resp_readburst_byte_length  = (req_readburst_do)? req_readburst_byte_length  : byte_length;
90
 
91
//------------------------------------------------------------------------------
92
 
93
//------------------------------------------------------------------------------
94
 
95
//------------------------------------------------------------------------------
96
 
97
endmodule

powered by: WebSVN 2.1.0

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