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

Subversion Repositories ao486

[/] [ao486/] [trunk/] [rtl/] [ao486/] [memory/] [link_readline.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_readline(
32
    input               clk,
33
    input               rst_n,
34
 
35
    // readline REQ
36
    input               req_readline_do,
37
    output              req_readline_done,
38
 
39
    input       [31:0]  req_readline_address,
40
    output      [127:0] req_readline_line,
41
 
42
    // readline RESP
43
    output              resp_readline_do,
44
    input               resp_readline_done,
45
 
46
    output      [31:0]  resp_readline_address,
47
    input       [127:0] resp_readline_line
48
);
49
 
50
//------------------------------------------------------------------------------
51
 
52
reg         current_do;
53
reg [31:0]  address;
54
 
55
//------------------------------------------------------------------------------
56
 
57
wire save;
58
 
59
//------------------------------------------------------------------------------
60
 
61
assign save  = req_readline_do && ~(resp_readline_done);
62
 
63
//------------------------------------------------------------------------------
64
 
65
always @(posedge clk or negedge rst_n) begin
66
    if(rst_n == 1'b0)               current_do <= `FALSE;
67
    else if(save)                   current_do <= req_readline_do;
68
    else if(resp_readline_done)     current_do <= `FALSE;
69
end
70
 
71
always @(posedge clk or negedge rst_n) begin if(rst_n == 1'b0) address <= 32'd0; else if(save) address <= req_readline_address;      end
72
 
73
//------------------------------------------------------------------------------
74
 
75
assign req_readline_done = resp_readline_done;
76
assign req_readline_line = resp_readline_line;
77
 
78
assign resp_readline_do      = (req_readline_do)? req_readline_do      : current_do;
79
assign resp_readline_address = (req_readline_do)? req_readline_address : address;
80
 
81
//------------------------------------------------------------------------------
82
 
83
//------------------------------------------------------------------------------
84
 
85
//------------------------------------------------------------------------------
86
 
87
endmodule

powered by: WebSVN 2.1.0

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