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

Subversion Repositories pci

[/] [pci/] [tags/] [working_demo/] [old_stuff/] [pci_master32/] [pci_master32_sm.v] - Blame information for rev 154

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 mihad
`include "pci_stat.v"
2
 
3
module pci_master32_sm
4
(
5
    // system inputs
6
    clk_in,
7
    reset_in,
8
    // arbitration
9
    pci_req_out,
10
    pci_req_en_out,
11
    pci_gnt_in,
12
    // master in/outs
13
    pci_frame_in,
14
    pci_frame_out,
15
    pci_frame_en_out,
16
    pci_irdy_in,
17
    pci_irdy_out,
18
    pci_irdy_en_out,
19
    // target response inputs
20
    pci_trdy_in,
21
    pci_stop_in,
22
    pci_devsel_in,
23
    // address, data, bus command, byte enable in/outs
24
    pci_ad_in,
25
    pci_ad_out,
26
    pci_ad_en_out,
27
    pci_cbe_out,
28
    pci_cbe_en_out,
29
 
30
    // other side of state machine
31
    address_i,
32
    bc_i,
33
    data_i,
34
    data_o,
35
    be_i,
36
    req_i,
37
    rdy_i,
38
    status_o,
39
    last_i,
40
    latency_tim_val_i
41
) ;
42
 
43
// system inputs
44
input   clk_in,
45
        reset_in ;
46
 
47
/*==================================================================================================================
48
PCI interface signals - bidirectional signals are divided to inputs and outputs in I/O cells instantiation
49
module. Enables are separate signals.
50
==================================================================================================================*/
51
// arbitration
52
output  pci_req_out,
53
        pci_req_en_out ;
54
 
55
input   pci_gnt_in ;
56
 
57
// master in/outs
58
input    pci_frame_in ;
59
 
60
output   pci_frame_out,
61
         pci_frame_en_out ;
62
 
63
input    pci_irdy_in ;
64
output   pci_irdy_out,
65
         pci_irdy_en_out,
66
 
67
// target response inputs
68
input   pci_trdy_in,
69
        pci_stop_in,
70
        pci_devsel_in ;
71
 
72
// address, data, bus command, byte enable in/outs
73
input   [31:0]  pci_ad_in ;
74
output  [31:0]  pci_ad_out ;
75
output          pci_ad_en_out ;
76
output  [3:0]   pci_cbe_out ;
77
output          pci_cbe_en_out ;
78
 
79
/*==================================================================================================================
80
Other side of master state machine - the one that issues requests.
81
==================================================================================================================*/
82
/*==================================================================================================================
83
address input - address always qualifies current data present at data_i input or data that needs to be read from
84
                data_o output.
85
==================================================================================================================*/
86
input   [31:0]  address_i ; // current request address input
87
 
88
/*==================================================================================================================
89
bus command input - bus command is always valid vhen request is asserted and identifies what state machine should
90
                    do.
91
==================================================================================================================*/
92
input   [3:0]   bc_i ;      // current request bus command input
93
 
94
/*==================================================================================================================
95
data input - for PCI write bus commands - this bus provides valid write data during write commands when rdy_i is
96
             asserted. If rdy_i is deasserted then state machine inserts wait states ( if between burst )
97
==================================================================================================================*/
98
input   [31:0]  data_i ;    // current dataphase data input
99
 
100
/*==================================================================================================================
101
data output - for PCI read bus commands - data on this bus is provided from master state machine and is qualified
102
              with `TRANSFERED status. When `TRANSFERED status is present on status output, backend is responsible
103
              for storing this data. Backend signals if it is ready to accept data with rdy_i input.
104
==================================================================================================================*/
105
output  [31:0]  data_o ;    // for read operations - current request data output
106
 
107
/*==================================================================================================================
108
byte enable input - active low byte enables for driving BE# pins on pci during transfers - they are valid always
109
                    when request is asserted by the backend
110
==================================================================================================================*/
111
input   [3:0]   be_i ;      // current dataphase byte enable inputs
112
 
113
/*==================================================================================================================
114
request and ready inputs from backend - req_i input means that backend has some transaction request for PCI bus.
115
During write requests it must provide address, bus command, byte enables and data. Write data is qualified with
116
rdy_i signal input. State machine signals status back to the backend. Statuses are described later.
117
During read requests backend must provide address, bus command and byte enables to the state machine. When it is ready
118
to receive data, it asserts rdy_i. Status of current request is signaled to back end all the time.
119
==================================================================================================================*/
120
input           req_i ;     // initiator cycle is requested
121
input           rdy_i ;     // requestor indicates that data is ready to be sent for write transaction and ready to
122
                            // be received on read transaction
123
/*==================================================================================================================
124
Last input - this input in conjuction with req_i and rdy_i qualifies last data beat in current request.
125
             for single transfers all three signals are asserted in parallel, for burst transfers last_i is inactive
126
             until last intended data is present at data_i or requested from data_o. After last is sampled asserted,
127
             state machine must go to idle state and monitor for new requests.
128
==================================================================================================================*/
129
input           last_i ;    // last dataphase in current transaction indicator
130
 
131
/*==================================================================================================================
132
Status output - Status is always provided to the backend depending on PCI transaction progress. Status descriptions:
133
`WAIT - default status - means that current request is not processed in any way yet - this status is propagated
134
        to backend when Master state machine is requesting for the bus, latency timer has expired on current phase,
135
        target is inserting wait states or rdy_i input is down.
136
`TRANSFERED - status means, that current data phase is completing succesfully on PCI bus. During writes, this status
137
              signals to the backend that it should provide new data imediately after rising clock edge or deassert
138
              rdy_i if it is not ready to do so. During reads, this status signals to the backend that on the rising
139
              edge of clock data must be latched from data_o bus. After this, backend must deassert rdy_i if it is not
140
              ready to accept more data.
141
`DISCONNECT_WO_DATA - Disconnect Without Data can be treated by the backend the same as `WAIT status. Separate status
142
                      is provided only becuse some backends might use it for different purposes.
143
`DISCONNECT_W_DATA  - Dissconnect With Data can be treated the same as `TRANSFERED status. Separate status is
144
                      provided because some backends might use it for different purposes
145
`TABORT - Target Abort status - current transfer resulted in target abort termination. Backend must not repeat this
146
                                transaction anymore. State machine is not responsible for error handling
147
`MABORT - State Machine signals this status to backend when no Target claims the transaction. Backend must decide if
148
          this is an error or not. State machine isn't responsible for error handling
149
`RETRY  - State Machine signals this status to backend when Target Retry occurs on current dataphase. State Machine
150
          is responsible for releasing a bus, by PCI protocol, while transaction repeating is up to backend.
151
==================================================================================================================*/
152
output  [3:0]   status_o ;  // current dataphase completion status
153
 
154
// latency timer value input - state machine starts latency timer whenever it starts a transaction and last is not
155
// asserted ( meaning burst transfer ). 
156
input [7:0] latency_tim_val_i ;
157
 
158
endmodule

powered by: WebSVN 2.1.0

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