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

Subversion Repositories ao486

[/] [ao486/] [trunk/] [rtl/] [ao486/] [memory/] [link_readcode.v] - Blame information for rev 6

Go to most recent revision | 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_readcode(
32
    input               clk,
33
    input               rst_n,
34
 
35
    // readcode REQ
36
    input               req_readcode_do,
37
    output              req_readcode_done,
38
 
39
    input       [31:0]  req_readcode_address,
40
    output      [127:0] req_readcode_line,
41
    output      [31:0]  req_readcode_partial,
42
    output              req_readcode_partial_done,
43
 
44
    // readcode RESP
45
    output              resp_readcode_do,
46
    input               resp_readcode_done,
47
 
48
    output      [31:0]  resp_readcode_address,
49
    input       [127:0] resp_readcode_line,
50
    input       [31:0]  resp_readcode_partial,
51
    input               resp_readcode_partial_done
52
);
53
 
54
//------------------------------------------------------------------------------
55
 
56
reg         current_do;
57
reg [31:0]  address;
58
 
59
//------------------------------------------------------------------------------
60
 
61
wire save;
62
 
63
//------------------------------------------------------------------------------
64
 
65
assign save  = req_readcode_do && ~(resp_readcode_done);
66
 
67
//------------------------------------------------------------------------------
68
 
69
always @(posedge clk or negedge rst_n) begin
70
    if(rst_n == 1'b0)               current_do <= `FALSE;
71
    else if(save)                   current_do <= req_readcode_do;
72
    else if(resp_readcode_done)     current_do <= `FALSE;
73
end
74
 
75
always @(posedge clk or negedge rst_n) begin if(rst_n == 1'b0) address <= 32'd0; else if(save) address <= req_readcode_address; end
76
 
77
//------------------------------------------------------------------------------
78
 
79
assign req_readcode_done         = resp_readcode_done;
80
assign req_readcode_line         = resp_readcode_line;
81
assign req_readcode_partial      = resp_readcode_partial;
82
assign req_readcode_partial_done = resp_readcode_partial_done;
83
 
84
assign resp_readcode_do      = (req_readcode_do)? req_readcode_do      : current_do;
85
assign resp_readcode_address = (req_readcode_do)? req_readcode_address : address;
86
 
87
//------------------------------------------------------------------------------
88
 
89
//------------------------------------------------------------------------------
90
 
91
//------------------------------------------------------------------------------
92
 
93
endmodule

powered by: WebSVN 2.1.0

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