ImplementationIdeas
Some thoughts about the implementation of GreenBus
If we manage to have just one type of transaction for ALL protocols, then there will be less copies when transforming a transaction from one protocol to another. This transaction must give the user access to data in different bus-sizes, and timing should be completely separated from the transaction structure, so the same structure is used in any abstraction level.
The transaction
My suggestion for this transaction structure is to be as simple as:
- struct transaction
- {
- // Each protocol defines their commands as an enum
- // then one can use: trans.cmd = OCP::READ;
- int cmd;
- // Set the maximum data size in bytes (the maximum burst possible)
- // I don't know this number, it is just a guess
- static const unsigned int data_size = 1024;
- // Data can be accessed in many bus-sizes
- // example for the third phase of dada handshake in 16bit bus:
- // trans.data.as16bit[2] = /*whatever*/;
- union {
- uint8 as8bit [data_size];
- uint16 as16bit[data_size/2];
- uint32 as32bit[data_size/4];
- } data;
- // Maybe address quark should use the same technique as data
- // so we don't fix and address type/size
- union {/*...*/} addr;
- };
The atom
Anything related to timing (phases of the protocol) or error handling should be in a separate structure, the atom! Note that, following this idea, an atom is not inside the transaction anymore. So, it breaks the TAC figure.
- struct atom
- {
- // Each protocol defines their own phases (atoms?) as an enum
- // there should be different sets of phases for different
- // levels of abstraction, so a master in a higher level of
- // abstraction can talk with a slave that accepts many levels
- // of abstraction
- int phase;
- // Error is also a protocol-specific enum
- int error;
- };
The protocol
Then protocols are just a structure defining the enum's:
- struct my_protocol {
- enum command {READ, WRITE};
- // Maybe the phases are just the "master view", like
- // mini-transactions
- enum phase {
- PV_req, /* PV level */
- PVT_lock, /* PVT level (burst) */
- PVT_req,
- PVT_data1,
- PVT_data2,
- PVT_finish
- };
- enum error {ADDR_INVALID, LOCK_FAIL, /*...*/};
- };
Dealing with multiple transactions
The router or bridge could have a map (master,transaction id). Then, after an answer from a slave, the router/bridge can route the transaction back to the originating master. I'm not sure: may the master initiate another transaction before the completion of a previous one? If true, then it would be a list of transactions associated with a master. The slave may be always chosen by the address of the transaction (or maybe the command), right?
The router
It may convert the address for the slave, removing the slave-selection part of the address. When returning a transaction to master, it returns the address to the original value, so another phase of the protocol can be done (with the same slave).
The bridge
It knows to convert atoms from one protocol to another. I'm not sure it it's necessary to recover the original atom when returning the transaction to master.
Identifying the correct protocol
This operation should be done in elaboration time. There must be some way to do this when ports binds... but I didn't have time to study this yet. Checking it in simulation run-time it to time-consuming!
Posted January 8th, 2008 by WolfgangKlingauf