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

Subversion Repositories dma_ahb

[/] [dma_ahb/] [trunk/] [src/] [dma_ahb32/] [prgen_joint_stall.v] - Blame information for rev 4

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 eyalhoc
/////////////////////////////////////////////////////////////////////
2
////                                                             ////
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
/////////////////////////////////////////////////////////////////////
29 2 eyalhoc
//---------------------------------------------------------
30
//-- File generated by RobustVerilog parser
31
//-- Version: 1.0
32
//-- Invoked Fri Mar 25 23:31:22 2011
33
//--
34
//-- Source file: prgen_joint_stall.v
35
//---------------------------------------------------------
36
 
37
 
38
 
39
module prgen_joint_stall(clk,reset,joint_req_out,rd_transfer,rd_transfer_size,ch_fifo_rd,data_fullness_pre,HOLD,joint_fifo_rd_valid,rd_transfer_size_joint,rd_transfer_full,joint_stall);
40
 
41
   parameter                  SIZE_BITS   = 1;
42
 
43
   input               clk;
44
   input               reset;
45
 
46
   input               joint_req_out;
47
   input               rd_transfer;
48
   input [SIZE_BITS-1:0]      rd_transfer_size;
49
   input               ch_fifo_rd;
50
   input [2:0]               data_fullness_pre;
51
   input               HOLD;
52
 
53
   output               joint_fifo_rd_valid;
54
   output [SIZE_BITS-1:0]     rd_transfer_size_joint;
55
   output               rd_transfer_full;
56
   output               joint_stall;
57
 
58
 
59
 
60
 
61
   wire               rd_transfer_joint;
62
   wire               joint_fifo_rd;
63
   wire               joint_fifo_rd_valid;
64
   wire [2:0]               count_ch_fifo_pre;
65
   reg [2:0]               count_ch_fifo;
66
   wire               joint_stall_pre;
67
   reg                   joint_stall_reg;
68
   wire               joint_not_ready_pre;
69
   wire               joint_not_ready;
70
   wire [SIZE_BITS-1:0]       rd_transfer_size_joint;
71
   wire               rd_transfer_full;
72
   reg [2:0]               joint_rd_stall_num;
73
   wire               joint_rd_stall;
74
 
75
 
76
 
77
 
78
   assign               rd_transfer_joint   = joint_req_out & rd_transfer;
79
 
80
   prgen_delay #(2) delay_joint_fifo_rd (.clk(clk), .reset(reset), .din(rd_transfer_joint), .dout(joint_fifo_rd));
81
 
82
   assign               count_ch_fifo_pre   = count_ch_fifo + rd_transfer_joint - ch_fifo_rd;
83
 
84
   //count fullness of channel's fifo
85
   always @(posedge clk or posedge reset)
86
     if (reset)
87
       count_ch_fifo <= #1 3'd0;
88
     else if (joint_req_out & (rd_transfer_joint | ch_fifo_rd))
89
       count_ch_fifo <= #1 count_ch_fifo_pre;
90
 
91
   //prevent read channel to overflow the channel's fifo
92
   assign               joint_stall_pre     = joint_req_out & ((count_ch_fifo_pre > 'd2) | ((count_ch_fifo_pre == 'd2) & (data_fullness_pre > 'd1)) | HOLD);
93
 
94
   //prevent write channel to overflow the wr data fifo
95
   assign               joint_not_ready_pre = joint_req_out & (data_fullness_pre > 'd1) & (~(rd_transfer_joint & joint_stall_pre));
96
 
97
 
98
   always @(posedge clk or posedge reset)
99
     if (reset)
100
       joint_stall_reg <= #1 1'b0;
101
     else if (joint_stall_pre)
102
       joint_stall_reg <= #1 1'b1;
103
     else if (count_ch_fifo_pre == 'd0)
104
       joint_stall_reg <= #1 1'b0;
105
 
106
   assign               joint_stall = joint_stall_reg | (joint_req_out & HOLD);
107
 
108
   prgen_delay #(1) delay_joint_not_ready (.clk(clk), .reset(reset), .din(joint_not_ready_pre), .dout(joint_not_ready));
109
 
110
 
111
   prgen_fifo #(SIZE_BITS, 2)
112
   rd_transfer_fifo(
113
            .clk(clk),
114
            .reset(reset),
115
            .push(rd_transfer_joint),
116
            .pop(joint_fifo_rd_valid),
117
            .din(rd_transfer_size),
118
            .dout(rd_transfer_size_joint),
119
            .empty(),
120
            .full(rd_transfer_full)
121
            );
122
 
123
   prgen_stall #(3) stall_joint_fifo_rd (.clk(clk), .reset(reset), .din(joint_fifo_rd), .stall(joint_not_ready), .dout(joint_fifo_rd_valid));
124
 
125
 
126
endmodule
127
 
128
 
129
 
130
 
131
 
132
 
133
 
134
 

powered by: WebSVN 2.1.0

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