L'interface WishBone
Comme nous allons être amené à utiliser principalement l'interface WishBone, voici une description des signaux et des interfaces.
Signal WishBone
Un signal WishBone est une structure de signaux SystemC. Cette structure rassemble les signaux de données et d'adresse ainsi que les signaux de contrôle.
class WbSignal {
public:
sc_core::sc_signal<typename wb_param::wb_data_t> MWDAT; // masters output data
sc_core::sc_signal<typename wb_param::wb_data_t> MRDAT; // masters input data
sc_core::sc_signal<typename wb_param::wb_add_t> ADR; // master output address
sc_core::sc_signal<bool> ACK; // Acknowledge from slave
sc_core::sc_signal<bool> CYC; // cycle valid
sc_core::sc_signal<bool> ERR; // error from slave
sc_core::sc_signal<bool> LOCK; // lock request
sc_core::sc_signal<bool> RTY; // retry from slave
sc_core::sc_signal<typename wb_param::wb_sel_t> SEL; // BE
sc_core::sc_signal<bool> STB; // commande valid
sc_core::sc_signal<bool> WE; // write enable
}
Port maître WishBone
Un port maître WishBone est une structure regroupant des port SystemC.
Les noms des ports ont les suffixes _I et _O en fonction de leur sens vu par le maître.
Un port maître peut être connecté à :
- Un signal WishBone, c'est l'utilisation standard.
- Un autre port WishBone maître, il devient alors transparent
On ne peut pas connecter un port maître directement à un port esclave sans signal intermédiaire.
class WbMaster {
public:
sc_core::sc_out<typename wb_param::wb_data_t> DAT_O;
sc_core::sc_in <typename wb_param::wb_data_t> DAT_I;
sc_core::sc_out<typename wb_param::wb_add_t> ADR_O;
sc_core::sc_in <bool> ACK_I;
sc_core::sc_out<bool> CYC_O;
sc_core::sc_in <bool> ERR_I;
sc_core::sc_out<bool> LOCK_O;
sc_core::sc_in <bool> RTY_I;
sc_core::sc_out<typename wb_param::wb_sel_t> SEL_O;
sc_core::sc_out<bool> STB_O;
sc_core::sc_out<bool> WE_O;
...
}
Port esclave WishBone
Un port esclave WishBone est une structure regroupant des port SystemC.
Les noms des ports ont les suffixes _I et _O en fonction de leur sens vu par le esclave.
Un port esclave peut être connecté à :
- Un signal WishBone, c'est l'utilisation standard.
- Un autre port WishBone esclave, il devient alors transparent
On ne peut pas connecter un port esclave directement à un port maître sans signal intermédiaire.
class WbSlave {
public:
sc_core::sc_in <typename wb_param::wb_data_t> DAT_I;
sc_core::sc_out<typename wb_param::wb_data_t> DAT_O;
sc_core::sc_in <typename wb_param::wb_add_t> ADR_I;
sc_core::sc_out<bool> ACK_O;
sc_core::sc_in <bool> CYC_I;
sc_core::sc_out<bool> ERR_O;
sc_core::sc_in <bool> LOCK_I;
sc_core::sc_out<bool> RTY_O;
sc_core::sc_in <typename wb_param::wb_sel_t> SEL_I;
sc_core::sc_in <bool> STB_I;
sc_core::sc_in <bool> WE_I;
...
}
Les paramètres WishBone
Les ports et signaux WishBone sont paramétrables. On peut préciser la largeur du bus de données et du bus d'adresse.
Les données transportées par cette interface sont des sc_uint de largeur paramétrable.
class WbParams {
public:
// Constants which can be used externally
static const int DataWidth = data_width;
static const int AddWidth = add_width;
static const int BeWidth = data_width/8;
// Signal types
typedef sc_dt::sc_uint<datawidth> wb_data_t;
typedef sc_dt::sc_uint<addwidth> wb_add_t;
typedef sc_dt::sc_uint<datawidth/8> wb_sel_t;
...
}
Le code source complet est accessible ici:
/comelec/softs/opt/soclib/soclib/communication/wishbone/