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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [orpsocv2/] [boards/] [actel/] [ordb1a3pe1500/] [rtl/] [verilog/] [sdc_controller/] [sd_fifo_tx_filler.v] - Blame information for rev 544

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 544 julius
`include "sd_defines.v"
2
 
3
module sd_fifo_tx_filler
4
(
5
input clk,
6
input rst,
7
//WB Signals
8
output  [31:0]  m_wb_adr_o,
9
 
10
output  reg        m_wb_we_o,
11
input   [31:0]  m_wb_dat_i,
12
 
13
output    reg      m_wb_cyc_o,
14
output   reg       m_wb_stb_o,
15
input           m_wb_ack_i,
16
output  reg     [2:0] m_wb_cti_o,
17
output  reg [1:0]         m_wb_bte_o,
18
 
19
//Data Master Control signals
20
input en,
21
input [31:0] adr,
22
 
23
 
24
//Data Serial signals 
25
input sd_clk,
26
output [31:0] dat_o,
27
input rd,
28
output empty,
29
output fe
30
//
31
 
32
);
33
reg reset_tx_fifo;
34
 
35
reg [31:0] din;
36
reg wr_tx;
37
reg [8:0] we;
38
reg [8:0] offset;
39
wire [5:0]mem_empt;
40
sd_tx_fifo Tx_Fifo (
41
.d ( din ),
42
.wr  (  wr_tx ),
43
.wclk  (clk),
44
.q ( dat_o),
45
.rd (rd),
46
.full (fe),
47
.empty (empty),
48
.mem_empt (mem_empt),
49
.rclk (sd_clk),
50
.rst  (rst | reset_tx_fifo)
51
);
52
 
53
 
54
assign  m_wb_adr_o = adr+offset;
55
 
56
 
57
reg first;
58
 
59
reg ackd;
60
reg delay;
61
 
62
always @(posedge clk or posedge rst )begin
63
 if (rst) begin
64
        offset <=0;
65
        we <= 8'h1;
66
        m_wb_we_o <=0;
67
        m_wb_cyc_o <= 0;
68
        m_wb_stb_o <= 0;
69
        wr_tx<=0;
70
        ackd <=1;
71
        delay<=0;
72
        reset_tx_fifo<=1;
73
 
74
        first<=1;
75
        din<=0;
76
                m_wb_bte_o <= 2'b00;
77
                m_wb_cti_o <= 3'b000;
78
 
79
 
80
 end
81
 else if (en) begin //Start filling the TX buffer
82
    reset_tx_fifo<=0;
83
 
84
          if (m_wb_ack_i) begin
85
                  wr_tx <=1;
86
                  din <=m_wb_dat_i;
87
 
88
                  m_wb_cyc_o <= 0;
89
                  m_wb_stb_o <= 0;
90
                  delay<=~ delay;
91
                end
92
                else begin
93
                        wr_tx <=0;
94
 
95
                end
96
 
97
          if (delay)begin
98
             offset<=offset+`MEM_OFFSET;
99
             ackd<=~ackd;
100
             delay<=~ delay;
101
             wr_tx <=0;
102
          end
103
 
104
                if ( !m_wb_ack_i & !fe & ackd  ) begin //If not full And no Ack  
105
                  m_wb_we_o <=0;
106
                        m_wb_cyc_o <= 1;
107
                        m_wb_stb_o <= 1;
108
                        ackd<=0;
109
                end
110
 
111
 
112
 end
113
 else begin
114
   offset <=0;
115
   reset_tx_fifo<=1;
116
   m_wb_cyc_o <= 0;
117
   m_wb_stb_o <= 0;
118
   m_wb_we_o <=0;
119
 
120
 
121
 end
122
end
123
 
124
endmodule
125
 
126
 

powered by: WebSVN 2.1.0

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