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 2

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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