1 |
25 |
robfinch |
`timescale 1ns/1ps
|
2 |
|
|
// ============================================================================
|
3 |
|
|
// __
|
4 |
|
|
// \\__/ o\ (C) 2013-2023 Robert Finch, Waterloo
|
5 |
|
|
// \ __ / All rights reserved.
|
6 |
|
|
// \/_// robfinch@finitron.ca
|
7 |
|
|
// ||
|
8 |
|
|
//
|
9 |
|
|
//
|
10 |
|
|
// BSD 3-Clause License
|
11 |
|
|
// Redistribution and use in source and binary forms, with or without
|
12 |
|
|
// modification, are permitted provided that the following conditions are met:
|
13 |
|
|
//
|
14 |
|
|
// 1. Redistributions of source code must retain the above copyright notice, this
|
15 |
|
|
// list of conditions and the following disclaimer.
|
16 |
|
|
//
|
17 |
|
|
// 2. Redistributions in binary form must reproduce the above copyright notice,
|
18 |
|
|
// this list of conditions and the following disclaimer in the documentation
|
19 |
|
|
// and/or other materials provided with the distribution.
|
20 |
|
|
//
|
21 |
|
|
// 3. Neither the name of the copyright holder nor the names of its
|
22 |
|
|
// contributors may be used to endorse or promote products derived from
|
23 |
|
|
// this software without specific prior written permission.
|
24 |
|
|
//
|
25 |
|
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
26 |
|
|
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
27 |
|
|
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
28 |
|
|
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
29 |
|
|
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
30 |
|
|
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
31 |
|
|
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
32 |
|
|
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
33 |
|
|
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
34 |
|
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
35 |
|
|
//
|
36 |
|
|
// ============================================================================
|
37 |
|
|
|
38 |
|
|
import fta_bus_pkg::*;
|
39 |
|
|
|
40 |
|
|
module fta_asynch2sync128(rst, clk, req_i, resp_o, req_o, resp_i);
|
41 |
|
|
input rst;
|
42 |
|
|
input clk;
|
43 |
|
|
input fta_cmd_request128_t req_i;
|
44 |
|
|
output fta_cmd_response128_t resp_o;
|
45 |
|
|
output fta_cmd_request128_t req_o;
|
46 |
|
|
input fta_cmd_response128_t resp_i;
|
47 |
|
|
|
48 |
|
|
reg aer_i;
|
49 |
|
|
|
50 |
|
|
always_ff @(posedge clk, posedge rst)
|
51 |
|
|
if (rst) begin
|
52 |
|
|
req_o <= 'd0;
|
53 |
|
|
resp_o <= 'd0;
|
54 |
|
|
end
|
55 |
|
|
else begin
|
56 |
|
|
aer_i <= resp_i.ack|resp_i.err|resp_i.rty;
|
57 |
|
|
// If a cycle is pulsed, latch the request.
|
58 |
|
|
if (req_i.cyc)
|
59 |
|
|
req_o <= req_i;
|
60 |
|
|
// On an ack, clear the request
|
61 |
|
|
else if (resp_i.ack|resp_i.err|resp_i.rty)
|
62 |
|
|
req_o <= 'd0;
|
63 |
|
|
// On an ack, pulse the ack response
|
64 |
|
|
if ((resp_i.ack|resp_i.err|resp_i.rty) & ~aer_i)
|
65 |
|
|
resp_o <= resp_i;
|
66 |
|
|
else
|
67 |
|
|
resp_o <= 'd0;
|
68 |
|
|
end
|
69 |
|
|
|
70 |
|
|
endmodule
|