added sc_comm_singleton to coordinate interaction with clients (e.g. web
browser)
This commit is contained in:
@ -86,6 +86,14 @@ public:
|
||||
|
||||
sc_core::sc_in<bool> rst_i;
|
||||
|
||||
sc_core::sc_in<bool> global_irq_i;
|
||||
|
||||
sc_core::sc_in<bool> timer_irq_i;
|
||||
|
||||
sc_core::sc_in<bool> sw_irq_i;
|
||||
|
||||
sc_core::sc_vector<sc_core::sc_in<bool>> local_irq_i;
|
||||
|
||||
scc::ext_attribute<std::string> elf_file;
|
||||
|
||||
scc::ext_attribute<bool> enable_disass;
|
||||
@ -124,6 +132,9 @@ protected:
|
||||
void start_of_simulation();
|
||||
void run();
|
||||
void clk_cb();
|
||||
void sw_irq_cb();
|
||||
void timer_irq_cb();
|
||||
void global_irq_cb();
|
||||
util::range_lut<tlm_dmi_ext> read_lut, write_lut;
|
||||
tlm_utils::tlm_quantumkeeper quantum_keeper;
|
||||
std::vector<uint8_t> write_buf;
|
||||
|
@ -28,7 +28,7 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Created on: Wed Oct 04 10:06:35 CEST 2017
|
||||
// Created on: Fri Nov 10 18:01:53 CET 2017
|
||||
// * aon_regs.h Author: <RDL Generator>
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -36,66 +36,69 @@
|
||||
#ifndef _AON_REGS_H_
|
||||
#define _AON_REGS_H_
|
||||
|
||||
#include <scc/utilities.h>
|
||||
#include <util/bit_field.h>
|
||||
#include "scc/register.h"
|
||||
#include "scc/tlm_target.h"
|
||||
#include "scc/utilities.h"
|
||||
#include <scc/register.h>
|
||||
#include <scc/tlm_target.h>
|
||||
|
||||
namespace sysc {
|
||||
|
||||
class aon_regs : public sc_core::sc_module, public scc::resetable {
|
||||
class aon_regs :
|
||||
public sc_core::sc_module,
|
||||
public scc::resetable
|
||||
{
|
||||
public:
|
||||
// storage declarations
|
||||
uint32_t r_wdogcfg;
|
||||
|
||||
|
||||
uint32_t r_wdogcount;
|
||||
|
||||
|
||||
uint32_t r_wdogs;
|
||||
|
||||
|
||||
uint32_t r_wdogfeed;
|
||||
|
||||
|
||||
uint32_t r_wdogkey;
|
||||
|
||||
|
||||
uint32_t r_wdogcmp;
|
||||
|
||||
|
||||
uint32_t r_rtccfg;
|
||||
|
||||
|
||||
uint32_t r_rtclo;
|
||||
|
||||
|
||||
uint32_t r_rtchi;
|
||||
|
||||
|
||||
uint32_t r_rtcs;
|
||||
|
||||
|
||||
uint32_t r_rtccmp;
|
||||
|
||||
|
||||
uint32_t r_lfrosccfg;
|
||||
|
||||
|
||||
std::array<uint32_t, 32> r_backup;
|
||||
|
||||
|
||||
BEGIN_BF_DECL(pmuwakeupi_t, uint32_t);
|
||||
BF_FIELD(delay, 0, 4);
|
||||
BF_FIELD(vddpaden, 5, 1);
|
||||
BF_FIELD(corerst, 7, 1);
|
||||
BF_FIELD(hfclkrst, 8, 1);
|
||||
END_BF_DECL();
|
||||
BF_FIELD(delay, 0, 4);
|
||||
BF_FIELD(vddpaden, 5, 1);
|
||||
BF_FIELD(corerst, 7, 1);
|
||||
BF_FIELD(hfclkrst, 8, 1);
|
||||
END_BF_DECL() ;
|
||||
std::array<pmuwakeupi_t, 8> r_pmuwakeupi;
|
||||
|
||||
|
||||
BEGIN_BF_DECL(pmusleepi_t, uint32_t);
|
||||
BF_FIELD(delay, 0, 4);
|
||||
BF_FIELD(vddpaden, 5, 1);
|
||||
BF_FIELD(corerst, 7, 1);
|
||||
BF_FIELD(hfclkrst, 8, 1);
|
||||
END_BF_DECL();
|
||||
BF_FIELD(delay, 0, 4);
|
||||
BF_FIELD(vddpaden, 5, 1);
|
||||
BF_FIELD(corerst, 7, 1);
|
||||
BF_FIELD(hfclkrst, 8, 1);
|
||||
END_BF_DECL() ;
|
||||
std::array<pmusleepi_t, 8> r_pmusleepi;
|
||||
|
||||
|
||||
uint32_t r_pmuie;
|
||||
|
||||
|
||||
uint32_t r_pmucause;
|
||||
|
||||
|
||||
uint32_t r_pmusleep;
|
||||
|
||||
|
||||
uint32_t r_pmukey;
|
||||
|
||||
|
||||
// register declarations
|
||||
scc::sc_register<uint32_t> wdogcfg;
|
||||
scc::sc_register<uint32_t> wdogcount;
|
||||
@ -116,10 +119,11 @@ public:
|
||||
scc::sc_register<uint32_t> pmucause;
|
||||
scc::sc_register<uint32_t> pmusleep;
|
||||
scc::sc_register<uint32_t> pmukey;
|
||||
|
||||
|
||||
aon_regs(sc_core::sc_module_name nm);
|
||||
|
||||
template <unsigned BUSWIDTH = 32> void registerResources(scc::tlm_target<BUSWIDTH> &target);
|
||||
template<unsigned BUSWIDTH=32>
|
||||
void registerResources(scc::tlm_target<BUSWIDTH>& target);
|
||||
};
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@ -146,9 +150,12 @@ inline sysc::aon_regs::aon_regs(sc_core::sc_module_name nm)
|
||||
, NAMED(pmuie, r_pmuie, 0, *this)
|
||||
, NAMED(pmucause, r_pmucause, 0, *this)
|
||||
, NAMED(pmusleep, r_pmusleep, 0, *this)
|
||||
, NAMED(pmukey, r_pmukey, 0, *this) {}
|
||||
, NAMED(pmukey, r_pmukey, 0, *this)
|
||||
{
|
||||
}
|
||||
|
||||
template <unsigned BUSWIDTH> inline void sysc::aon_regs::registerResources(scc::tlm_target<BUSWIDTH> &target) {
|
||||
template<unsigned BUSWIDTH>
|
||||
inline void sysc::aon_regs::registerResources(scc::tlm_target<BUSWIDTH>& target) {
|
||||
target.addResource(wdogcfg, 0x0UL);
|
||||
target.addResource(wdogcount, 0x8UL);
|
||||
target.addResource(wdogs, 0x10UL);
|
||||
|
@ -28,7 +28,7 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Created on: Wed Oct 04 10:06:35 CEST 2017
|
||||
// Created on: Fri Nov 10 18:01:53 CET 2017
|
||||
// * clint_regs.h Author: <RDL Generator>
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -36,32 +36,36 @@
|
||||
#ifndef _CLINT_REGS_H_
|
||||
#define _CLINT_REGS_H_
|
||||
|
||||
#include <scc/utilities.h>
|
||||
#include <util/bit_field.h>
|
||||
#include "scc/register.h"
|
||||
#include "scc/tlm_target.h"
|
||||
#include "scc/utilities.h"
|
||||
#include <scc/register.h>
|
||||
#include <scc/tlm_target.h>
|
||||
|
||||
namespace sysc {
|
||||
|
||||
class clint_regs : public sc_core::sc_module, public scc::resetable {
|
||||
class clint_regs :
|
||||
public sc_core::sc_module,
|
||||
public scc::resetable
|
||||
{
|
||||
public:
|
||||
// storage declarations
|
||||
BEGIN_BF_DECL(msip_t, uint32_t);
|
||||
BF_FIELD(msip, 0, 1);
|
||||
BF_FIELD(msip, 0, 1);
|
||||
END_BF_DECL() r_msip;
|
||||
|
||||
|
||||
uint64_t r_mtimecmp;
|
||||
|
||||
|
||||
uint64_t r_mtime;
|
||||
|
||||
|
||||
// register declarations
|
||||
scc::sc_register<msip_t> msip;
|
||||
scc::sc_register<uint64_t> mtimecmp;
|
||||
scc::sc_register<uint64_t> mtime;
|
||||
|
||||
|
||||
clint_regs(sc_core::sc_module_name nm);
|
||||
|
||||
template <unsigned BUSWIDTH = 32> void registerResources(scc::tlm_target<BUSWIDTH> &target);
|
||||
template<unsigned BUSWIDTH=32>
|
||||
void registerResources(scc::tlm_target<BUSWIDTH>& target);
|
||||
};
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@ -72,9 +76,12 @@ inline sysc::clint_regs::clint_regs(sc_core::sc_module_name nm)
|
||||
: sc_core::sc_module(nm)
|
||||
, NAMED(msip, r_msip, 0, *this)
|
||||
, NAMED(mtimecmp, r_mtimecmp, 0, *this)
|
||||
, NAMED(mtime, r_mtime, 0, *this) {}
|
||||
, NAMED(mtime, r_mtime, 0, *this)
|
||||
{
|
||||
}
|
||||
|
||||
template <unsigned BUSWIDTH> inline void sysc::clint_regs::registerResources(scc::tlm_target<BUSWIDTH> &target) {
|
||||
template<unsigned BUSWIDTH>
|
||||
inline void sysc::clint_regs::registerResources(scc::tlm_target<BUSWIDTH>& target) {
|
||||
target.addResource(msip, 0x0UL);
|
||||
target.addResource(mtimecmp, 0x4000UL);
|
||||
target.addResource(mtime, 0xbff8UL);
|
||||
|
@ -1,16 +1,17 @@
|
||||
#ifndef _E300_PLAT_MAP_H_
|
||||
#define _E300_PLAT_MAP_H_
|
||||
// need double braces, see
|
||||
// https://stackoverflow.com/questions/6893700/how-to-construct-stdarray-object-with-initializer-list#6894191
|
||||
const std::array<scc::target_memory_map_entry<32>, 8> e300_plat_map = {{
|
||||
// need double braces, see https://stackoverflow.com/questions/6893700/how-to-construct-stdarray-object-with-initializer-list#6894191
|
||||
const std::array<scc::target_memory_map_entry<32>, 10> e300_plat_map = {{
|
||||
{&i_clint, 0x2000000, 0xc000},
|
||||
{&i_plic, 0xc000000, 0x200008},
|
||||
{&i_aon, 0x10000000, 0x150},
|
||||
{&i_prci, 0x10008000, 0x14},
|
||||
{&i_gpio, 0x10012000, 0x44},
|
||||
{&i_gpio0, 0x10012000, 0x44},
|
||||
{&i_uart0, 0x10013000, 0x1c},
|
||||
{&i_qspi0, 0x10014000, 0x78},
|
||||
{&i_uart1, 0x10023000, 0x1c},
|
||||
{&i_spi, 0x10014000, 0x78},
|
||||
{&i_qspi1, 0x10024000, 0x78},
|
||||
{&i_qspi2, 0x10034000, 0x78},
|
||||
}};
|
||||
|
||||
#endif /* _E300_PLAT_MAP_H_ */
|
||||
|
@ -28,7 +28,7 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Created on: Wed Oct 04 10:06:35 CEST 2017
|
||||
// Created on: Fri Nov 10 18:01:53 CET 2017
|
||||
// * gpio_regs.h Author: <RDL Generator>
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -36,50 +36,53 @@
|
||||
#ifndef _GPIO_REGS_H_
|
||||
#define _GPIO_REGS_H_
|
||||
|
||||
#include <scc/utilities.h>
|
||||
#include <util/bit_field.h>
|
||||
#include "scc/register.h"
|
||||
#include "scc/tlm_target.h"
|
||||
#include "scc/utilities.h"
|
||||
#include <scc/register.h>
|
||||
#include <scc/tlm_target.h>
|
||||
|
||||
namespace sysc {
|
||||
|
||||
class gpio_regs : public sc_core::sc_module, public scc::resetable {
|
||||
class gpio_regs :
|
||||
public sc_core::sc_module,
|
||||
public scc::resetable
|
||||
{
|
||||
public:
|
||||
// storage declarations
|
||||
uint32_t r_value;
|
||||
|
||||
|
||||
uint32_t r_input_en;
|
||||
|
||||
|
||||
uint32_t r_output_en;
|
||||
|
||||
|
||||
uint32_t r_port;
|
||||
|
||||
|
||||
uint32_t r_pue;
|
||||
|
||||
|
||||
uint32_t r_ds;
|
||||
|
||||
|
||||
uint32_t r_rise_ie;
|
||||
|
||||
|
||||
uint32_t r_rise_ip;
|
||||
|
||||
|
||||
uint32_t r_fall_ie;
|
||||
|
||||
|
||||
uint32_t r_fall_ip;
|
||||
|
||||
|
||||
uint32_t r_high_ie;
|
||||
|
||||
|
||||
uint32_t r_high_ip;
|
||||
|
||||
|
||||
uint32_t r_low_ie;
|
||||
|
||||
|
||||
uint32_t r_low_ip;
|
||||
|
||||
|
||||
uint32_t r_iof_en;
|
||||
|
||||
|
||||
uint32_t r_iof_sel;
|
||||
|
||||
|
||||
uint32_t r_out_xor;
|
||||
|
||||
|
||||
// register declarations
|
||||
scc::sc_register<uint32_t> value;
|
||||
scc::sc_register<uint32_t> input_en;
|
||||
@ -98,10 +101,11 @@ public:
|
||||
scc::sc_register<uint32_t> iof_en;
|
||||
scc::sc_register<uint32_t> iof_sel;
|
||||
scc::sc_register<uint32_t> out_xor;
|
||||
|
||||
|
||||
gpio_regs(sc_core::sc_module_name nm);
|
||||
|
||||
template <unsigned BUSWIDTH = 32> void registerResources(scc::tlm_target<BUSWIDTH> &target);
|
||||
template<unsigned BUSWIDTH=32>
|
||||
void registerResources(scc::tlm_target<BUSWIDTH>& target);
|
||||
};
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@ -126,9 +130,12 @@ inline sysc::gpio_regs::gpio_regs(sc_core::sc_module_name nm)
|
||||
, NAMED(low_ip, r_low_ip, 0, *this)
|
||||
, NAMED(iof_en, r_iof_en, 0, *this)
|
||||
, NAMED(iof_sel, r_iof_sel, 0, *this)
|
||||
, NAMED(out_xor, r_out_xor, 0, *this) {}
|
||||
, NAMED(out_xor, r_out_xor, 0, *this)
|
||||
{
|
||||
}
|
||||
|
||||
template <unsigned BUSWIDTH> inline void sysc::gpio_regs::registerResources(scc::tlm_target<BUSWIDTH> &target) {
|
||||
template<unsigned BUSWIDTH>
|
||||
inline void sysc::gpio_regs::registerResources(scc::tlm_target<BUSWIDTH>& target) {
|
||||
target.addResource(value, 0x0UL);
|
||||
target.addResource(input_en, 0x4UL);
|
||||
target.addResource(output_en, 0x8UL);
|
||||
|
@ -28,7 +28,7 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Created on: Wed Oct 04 10:06:35 CEST 2017
|
||||
// Created on: Fri Nov 10 18:01:53 CET 2017
|
||||
// * plic_regs.h Author: <RDL Generator>
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -36,41 +36,45 @@
|
||||
#ifndef _PLIC_REGS_H_
|
||||
#define _PLIC_REGS_H_
|
||||
|
||||
#include <scc/utilities.h>
|
||||
#include <util/bit_field.h>
|
||||
#include "scc/register.h"
|
||||
#include "scc/tlm_target.h"
|
||||
#include "scc/utilities.h"
|
||||
#include <scc/register.h>
|
||||
#include <scc/tlm_target.h>
|
||||
|
||||
namespace sysc {
|
||||
|
||||
class plic_regs : public sc_core::sc_module, public scc::resetable {
|
||||
class plic_regs :
|
||||
public sc_core::sc_module,
|
||||
public scc::resetable
|
||||
{
|
||||
public:
|
||||
// storage declarations
|
||||
BEGIN_BF_DECL(priority_t, uint32_t);
|
||||
BF_FIELD(priority, 0, 3);
|
||||
END_BF_DECL();
|
||||
std::array<priority_t, 255> r_priority;
|
||||
|
||||
uint32_t r_pending;
|
||||
|
||||
uint32_t r_enabled;
|
||||
|
||||
BF_FIELD(priority, 0, 3);
|
||||
END_BF_DECL() ;
|
||||
std::array<priority_t, 256> r_priority;
|
||||
|
||||
std::array<uint32_t, 8> r_pending;
|
||||
|
||||
std::array<uint32_t, 8> r_enabled;
|
||||
|
||||
BEGIN_BF_DECL(threshold_t, uint32_t);
|
||||
BF_FIELD(threshold, 0, 3);
|
||||
BF_FIELD(threshold, 0, 3);
|
||||
END_BF_DECL() r_threshold;
|
||||
|
||||
|
||||
uint32_t r_claim_complete;
|
||||
|
||||
|
||||
// register declarations
|
||||
scc::sc_register_indexed<priority_t, 255> priority;
|
||||
scc::sc_register<uint32_t> pending;
|
||||
scc::sc_register<uint32_t> enabled;
|
||||
scc::sc_register_indexed<priority_t, 256> priority;
|
||||
scc::sc_register_indexed<uint32_t, 8> pending;
|
||||
scc::sc_register_indexed<uint32_t, 8> enabled;
|
||||
scc::sc_register<threshold_t> threshold;
|
||||
scc::sc_register<uint32_t> claim_complete;
|
||||
|
||||
|
||||
plic_regs(sc_core::sc_module_name nm);
|
||||
|
||||
template <unsigned BUSWIDTH = 32> void registerResources(scc::tlm_target<BUSWIDTH> &target);
|
||||
template<unsigned BUSWIDTH=32>
|
||||
void registerResources(scc::tlm_target<BUSWIDTH>& target);
|
||||
};
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@ -83,10 +87,13 @@ inline sysc::plic_regs::plic_regs(sc_core::sc_module_name nm)
|
||||
, NAMED(pending, r_pending, 0, *this)
|
||||
, NAMED(enabled, r_enabled, 0, *this)
|
||||
, NAMED(threshold, r_threshold, 0, *this)
|
||||
, NAMED(claim_complete, r_claim_complete, 0, *this) {}
|
||||
, NAMED(claim_complete, r_claim_complete, 0, *this)
|
||||
{
|
||||
}
|
||||
|
||||
template <unsigned BUSWIDTH> inline void sysc::plic_regs::registerResources(scc::tlm_target<BUSWIDTH> &target) {
|
||||
target.addResource(priority, 0x4UL);
|
||||
template<unsigned BUSWIDTH>
|
||||
inline void sysc::plic_regs::registerResources(scc::tlm_target<BUSWIDTH>& target) {
|
||||
target.addResource(priority, 0x0UL);
|
||||
target.addResource(pending, 0x1000UL);
|
||||
target.addResource(enabled, 0x2000UL);
|
||||
target.addResource(threshold, 0x200000UL);
|
||||
|
@ -28,7 +28,7 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Created on: Wed Oct 04 10:06:35 CEST 2017
|
||||
// Created on: Fri Nov 10 18:01:53 CET 2017
|
||||
// * prci_regs.h Author: <RDL Generator>
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -36,52 +36,56 @@
|
||||
#ifndef _PRCI_REGS_H_
|
||||
#define _PRCI_REGS_H_
|
||||
|
||||
#include <scc/utilities.h>
|
||||
#include <util/bit_field.h>
|
||||
#include "scc/register.h"
|
||||
#include "scc/tlm_target.h"
|
||||
#include "scc/utilities.h"
|
||||
#include <scc/register.h>
|
||||
#include <scc/tlm_target.h>
|
||||
|
||||
namespace sysc {
|
||||
|
||||
class prci_regs : public sc_core::sc_module, public scc::resetable {
|
||||
class prci_regs :
|
||||
public sc_core::sc_module,
|
||||
public scc::resetable
|
||||
{
|
||||
public:
|
||||
// storage declarations
|
||||
BEGIN_BF_DECL(hfrosccfg_t, uint32_t);
|
||||
BF_FIELD(hfroscdiv, 0, 6);
|
||||
BF_FIELD(hfrosctrim, 16, 5);
|
||||
BF_FIELD(hfroscen, 30, 1);
|
||||
BF_FIELD(hfroscrdy, 31, 1);
|
||||
BF_FIELD(hfroscdiv, 0, 6);
|
||||
BF_FIELD(hfrosctrim, 16, 5);
|
||||
BF_FIELD(hfroscen, 30, 1);
|
||||
BF_FIELD(hfroscrdy, 31, 1);
|
||||
END_BF_DECL() r_hfrosccfg;
|
||||
|
||||
|
||||
BEGIN_BF_DECL(hfxosccfg_t, uint32_t);
|
||||
BF_FIELD(hfxoscrdy, 31, 1);
|
||||
BF_FIELD(hfxoscen, 30, 1);
|
||||
BF_FIELD(hfxoscrdy, 31, 1);
|
||||
BF_FIELD(hfxoscen, 30, 1);
|
||||
END_BF_DECL() r_hfxosccfg;
|
||||
|
||||
|
||||
BEGIN_BF_DECL(pllcfg_t, uint32_t);
|
||||
BF_FIELD(pllr, 0, 3);
|
||||
BF_FIELD(pllf, 4, 6);
|
||||
BF_FIELD(pllq, 10, 2);
|
||||
BF_FIELD(pllsel, 16, 1);
|
||||
BF_FIELD(pllrefsel, 17, 1);
|
||||
BF_FIELD(pllbypass, 18, 1);
|
||||
BF_FIELD(plllock, 31, 1);
|
||||
BF_FIELD(pllr, 0, 3);
|
||||
BF_FIELD(pllf, 4, 6);
|
||||
BF_FIELD(pllq, 10, 2);
|
||||
BF_FIELD(pllsel, 16, 1);
|
||||
BF_FIELD(pllrefsel, 17, 1);
|
||||
BF_FIELD(pllbypass, 18, 1);
|
||||
BF_FIELD(plllock, 31, 1);
|
||||
END_BF_DECL() r_pllcfg;
|
||||
|
||||
|
||||
uint32_t r_plloutdiv;
|
||||
|
||||
|
||||
uint32_t r_coreclkcfg;
|
||||
|
||||
|
||||
// register declarations
|
||||
scc::sc_register<hfrosccfg_t> hfrosccfg;
|
||||
scc::sc_register<hfxosccfg_t> hfxosccfg;
|
||||
scc::sc_register<pllcfg_t> pllcfg;
|
||||
scc::sc_register<uint32_t> plloutdiv;
|
||||
scc::sc_register<uint32_t> coreclkcfg;
|
||||
|
||||
|
||||
prci_regs(sc_core::sc_module_name nm);
|
||||
|
||||
template <unsigned BUSWIDTH = 32> void registerResources(scc::tlm_target<BUSWIDTH> &target);
|
||||
template<unsigned BUSWIDTH=32>
|
||||
void registerResources(scc::tlm_target<BUSWIDTH>& target);
|
||||
};
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@ -94,9 +98,12 @@ inline sysc::prci_regs::prci_regs(sc_core::sc_module_name nm)
|
||||
, NAMED(hfxosccfg, r_hfxosccfg, 0, *this)
|
||||
, NAMED(pllcfg, r_pllcfg, 0, *this)
|
||||
, NAMED(plloutdiv, r_plloutdiv, 0, *this)
|
||||
, NAMED(coreclkcfg, r_coreclkcfg, 0, *this) {}
|
||||
, NAMED(coreclkcfg, r_coreclkcfg, 0, *this)
|
||||
{
|
||||
}
|
||||
|
||||
template <unsigned BUSWIDTH> inline void sysc::prci_regs::registerResources(scc::tlm_target<BUSWIDTH> &target) {
|
||||
template<unsigned BUSWIDTH>
|
||||
inline void sysc::prci_regs::registerResources(scc::tlm_target<BUSWIDTH>& target) {
|
||||
target.addResource(hfrosccfg, 0x0UL);
|
||||
target.addResource(hfxosccfg, 0x4UL);
|
||||
target.addResource(pllcfg, 0x8UL);
|
||||
|
@ -28,7 +28,7 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Created on: Wed Oct 04 10:06:35 CEST 2017
|
||||
// Created on: Fri Nov 10 18:01:53 CET 2017
|
||||
// * spi_regs.h Author: <RDL Generator>
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -36,93 +36,96 @@
|
||||
#ifndef _SPI_REGS_H_
|
||||
#define _SPI_REGS_H_
|
||||
|
||||
#include <scc/utilities.h>
|
||||
#include <util/bit_field.h>
|
||||
#include "scc/register.h"
|
||||
#include "scc/tlm_target.h"
|
||||
#include "scc/utilities.h"
|
||||
#include <scc/register.h>
|
||||
#include <scc/tlm_target.h>
|
||||
|
||||
namespace sysc {
|
||||
|
||||
class spi_regs : public sc_core::sc_module, public scc::resetable {
|
||||
class spi_regs :
|
||||
public sc_core::sc_module,
|
||||
public scc::resetable
|
||||
{
|
||||
public:
|
||||
// storage declarations
|
||||
BEGIN_BF_DECL(sckdiv_t, uint32_t);
|
||||
BF_FIELD(div, 0, 12);
|
||||
BF_FIELD(div, 0, 12);
|
||||
END_BF_DECL() r_sckdiv;
|
||||
|
||||
|
||||
BEGIN_BF_DECL(sckmode_t, uint32_t);
|
||||
BF_FIELD(pha, 0, 1);
|
||||
BF_FIELD(pol, 1, 1);
|
||||
BF_FIELD(pha, 0, 1);
|
||||
BF_FIELD(pol, 1, 1);
|
||||
END_BF_DECL() r_sckmode;
|
||||
|
||||
|
||||
uint32_t r_csid;
|
||||
|
||||
|
||||
uint32_t r_csdef;
|
||||
|
||||
|
||||
BEGIN_BF_DECL(csmode_t, uint32_t);
|
||||
BF_FIELD(mode, 0, 2);
|
||||
BF_FIELD(mode, 0, 2);
|
||||
END_BF_DECL() r_csmode;
|
||||
|
||||
|
||||
BEGIN_BF_DECL(delay0_t, uint32_t);
|
||||
BF_FIELD(cssck, 0, 8);
|
||||
BF_FIELD(sckcs, 16, 8);
|
||||
BF_FIELD(cssck, 0, 8);
|
||||
BF_FIELD(sckcs, 16, 8);
|
||||
END_BF_DECL() r_delay0;
|
||||
|
||||
|
||||
BEGIN_BF_DECL(delay1_t, uint32_t);
|
||||
BF_FIELD(intercs, 0, 16);
|
||||
BF_FIELD(interxfr, 16, 8);
|
||||
BF_FIELD(intercs, 0, 16);
|
||||
BF_FIELD(interxfr, 16, 8);
|
||||
END_BF_DECL() r_delay1;
|
||||
|
||||
|
||||
BEGIN_BF_DECL(fmt_t, uint32_t);
|
||||
BF_FIELD(proto, 0, 2);
|
||||
BF_FIELD(endian, 2, 1);
|
||||
BF_FIELD(dir, 3, 1);
|
||||
BF_FIELD(len, 16, 4);
|
||||
BF_FIELD(proto, 0, 2);
|
||||
BF_FIELD(endian, 2, 1);
|
||||
BF_FIELD(dir, 3, 1);
|
||||
BF_FIELD(len, 16, 4);
|
||||
END_BF_DECL() r_fmt;
|
||||
|
||||
|
||||
BEGIN_BF_DECL(txdata_t, uint32_t);
|
||||
BF_FIELD(data, 0, 8);
|
||||
BF_FIELD(full, 31, 1);
|
||||
BF_FIELD(data, 0, 8);
|
||||
BF_FIELD(full, 31, 1);
|
||||
END_BF_DECL() r_txdata;
|
||||
|
||||
|
||||
BEGIN_BF_DECL(rxdata_t, uint32_t);
|
||||
BF_FIELD(data, 0, 8);
|
||||
BF_FIELD(empty, 31, 1);
|
||||
BF_FIELD(data, 0, 8);
|
||||
BF_FIELD(empty, 31, 1);
|
||||
END_BF_DECL() r_rxdata;
|
||||
|
||||
|
||||
BEGIN_BF_DECL(txmark_t, uint32_t);
|
||||
BF_FIELD(txmark, 0, 3);
|
||||
BF_FIELD(txmark, 0, 3);
|
||||
END_BF_DECL() r_txmark;
|
||||
|
||||
|
||||
BEGIN_BF_DECL(rxmark_t, uint32_t);
|
||||
BF_FIELD(rxmark, 0, 3);
|
||||
BF_FIELD(rxmark, 0, 3);
|
||||
END_BF_DECL() r_rxmark;
|
||||
|
||||
|
||||
BEGIN_BF_DECL(fctrl_t, uint32_t);
|
||||
BF_FIELD(en, 0, 1);
|
||||
BF_FIELD(en, 0, 1);
|
||||
END_BF_DECL() r_fctrl;
|
||||
|
||||
|
||||
BEGIN_BF_DECL(ffmt_t, uint32_t);
|
||||
BF_FIELD(cmd_en, 0, 1);
|
||||
BF_FIELD(addr_len, 1, 2);
|
||||
BF_FIELD(pad_cnt, 3, 4);
|
||||
BF_FIELD(cmd_proto, 7, 2);
|
||||
BF_FIELD(addr_proto, 9, 2);
|
||||
BF_FIELD(data_proto, 11, 2);
|
||||
BF_FIELD(cmd_code, 16, 8);
|
||||
BF_FIELD(pad_code, 24, 8);
|
||||
BF_FIELD(cmd_en, 0, 1);
|
||||
BF_FIELD(addr_len, 1, 2);
|
||||
BF_FIELD(pad_cnt, 3, 4);
|
||||
BF_FIELD(cmd_proto, 7, 2);
|
||||
BF_FIELD(addr_proto, 9, 2);
|
||||
BF_FIELD(data_proto, 11, 2);
|
||||
BF_FIELD(cmd_code, 16, 8);
|
||||
BF_FIELD(pad_code, 24, 8);
|
||||
END_BF_DECL() r_ffmt;
|
||||
|
||||
|
||||
BEGIN_BF_DECL(ie_t, uint32_t);
|
||||
BF_FIELD(txwm, 0, 1);
|
||||
BF_FIELD(rxwm, 1, 1);
|
||||
BF_FIELD(txwm, 0, 1);
|
||||
BF_FIELD(rxwm, 1, 1);
|
||||
END_BF_DECL() r_ie;
|
||||
|
||||
|
||||
BEGIN_BF_DECL(ip_t, uint32_t);
|
||||
BF_FIELD(txwm, 0, 1);
|
||||
BF_FIELD(rxwm, 1, 1);
|
||||
BF_FIELD(txwm, 0, 1);
|
||||
BF_FIELD(rxwm, 1, 1);
|
||||
END_BF_DECL() r_ip;
|
||||
|
||||
|
||||
// register declarations
|
||||
scc::sc_register<sckdiv_t> sckdiv;
|
||||
scc::sc_register<sckmode_t> sckmode;
|
||||
@ -140,10 +143,11 @@ public:
|
||||
scc::sc_register<ffmt_t> ffmt;
|
||||
scc::sc_register<ie_t> ie;
|
||||
scc::sc_register<ip_t> ip;
|
||||
|
||||
|
||||
spi_regs(sc_core::sc_module_name nm);
|
||||
|
||||
template <unsigned BUSWIDTH = 32> void registerResources(scc::tlm_target<BUSWIDTH> &target);
|
||||
template<unsigned BUSWIDTH=32>
|
||||
void registerResources(scc::tlm_target<BUSWIDTH>& target);
|
||||
};
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@ -167,9 +171,12 @@ inline sysc::spi_regs::spi_regs(sc_core::sc_module_name nm)
|
||||
, NAMED(fctrl, r_fctrl, 0, *this)
|
||||
, NAMED(ffmt, r_ffmt, 0, *this)
|
||||
, NAMED(ie, r_ie, 0, *this)
|
||||
, NAMED(ip, r_ip, 0, *this) {}
|
||||
, NAMED(ip, r_ip, 0, *this)
|
||||
{
|
||||
}
|
||||
|
||||
template <unsigned BUSWIDTH> inline void sysc::spi_regs::registerResources(scc::tlm_target<BUSWIDTH> &target) {
|
||||
template<unsigned BUSWIDTH>
|
||||
inline void sysc::spi_regs::registerResources(scc::tlm_target<BUSWIDTH>& target) {
|
||||
target.addResource(sckdiv, 0x0UL);
|
||||
target.addResource(sckmode, 0x4UL);
|
||||
target.addResource(csid, 0x10UL);
|
||||
|
@ -28,7 +28,7 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Created on: Wed Oct 04 10:06:35 CEST 2017
|
||||
// Created on: Fri Nov 10 18:01:53 CET 2017
|
||||
// * uart_regs.h Author: <RDL Generator>
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -36,51 +36,54 @@
|
||||
#ifndef _UART_REGS_H_
|
||||
#define _UART_REGS_H_
|
||||
|
||||
#include <scc/utilities.h>
|
||||
#include <util/bit_field.h>
|
||||
#include "scc/register.h"
|
||||
#include "scc/tlm_target.h"
|
||||
#include "scc/utilities.h"
|
||||
#include <scc/register.h>
|
||||
#include <scc/tlm_target.h>
|
||||
|
||||
namespace sysc {
|
||||
|
||||
class uart_regs : public sc_core::sc_module, public scc::resetable {
|
||||
class uart_regs :
|
||||
public sc_core::sc_module,
|
||||
public scc::resetable
|
||||
{
|
||||
public:
|
||||
// storage declarations
|
||||
BEGIN_BF_DECL(txdata_t, uint32_t);
|
||||
BF_FIELD(data, 0, 8);
|
||||
BF_FIELD(full, 31, 1);
|
||||
BF_FIELD(data, 0, 8);
|
||||
BF_FIELD(full, 31, 1);
|
||||
END_BF_DECL() r_txdata;
|
||||
|
||||
|
||||
BEGIN_BF_DECL(rxdata_t, uint32_t);
|
||||
BF_FIELD(data, 0, 8);
|
||||
BF_FIELD(empty, 31, 1);
|
||||
BF_FIELD(data, 0, 8);
|
||||
BF_FIELD(empty, 31, 1);
|
||||
END_BF_DECL() r_rxdata;
|
||||
|
||||
|
||||
BEGIN_BF_DECL(txctrl_t, uint32_t);
|
||||
BF_FIELD(txen, 0, 1);
|
||||
BF_FIELD(nstop, 1, 1);
|
||||
BF_FIELD(txcnt, 16, 3);
|
||||
BF_FIELD(txen, 0, 1);
|
||||
BF_FIELD(nstop, 1, 1);
|
||||
BF_FIELD(txcnt, 16, 3);
|
||||
END_BF_DECL() r_txctrl;
|
||||
|
||||
|
||||
BEGIN_BF_DECL(rxctrl_t, uint32_t);
|
||||
BF_FIELD(rxen, 0, 1);
|
||||
BF_FIELD(rxcnt, 16, 3);
|
||||
BF_FIELD(rxen, 0, 1);
|
||||
BF_FIELD(rxcnt, 16, 3);
|
||||
END_BF_DECL() r_rxctrl;
|
||||
|
||||
|
||||
BEGIN_BF_DECL(ie_t, uint32_t);
|
||||
BF_FIELD(txwm, 0, 1);
|
||||
BF_FIELD(rxwm, 1, 1);
|
||||
BF_FIELD(txwm, 0, 1);
|
||||
BF_FIELD(rxwm, 1, 1);
|
||||
END_BF_DECL() r_ie;
|
||||
|
||||
|
||||
BEGIN_BF_DECL(ip_t, uint32_t);
|
||||
BF_FIELD(txwm, 0, 1);
|
||||
BF_FIELD(rxwm, 1, 1);
|
||||
BF_FIELD(txwm, 0, 1);
|
||||
BF_FIELD(rxwm, 1, 1);
|
||||
END_BF_DECL() r_ip;
|
||||
|
||||
|
||||
BEGIN_BF_DECL(div_t, uint32_t);
|
||||
BF_FIELD(div, 0, 16);
|
||||
BF_FIELD(div, 0, 16);
|
||||
END_BF_DECL() r_div;
|
||||
|
||||
|
||||
// register declarations
|
||||
scc::sc_register<txdata_t> txdata;
|
||||
scc::sc_register<rxdata_t> rxdata;
|
||||
@ -89,10 +92,11 @@ public:
|
||||
scc::sc_register<ie_t> ie;
|
||||
scc::sc_register<ip_t> ip;
|
||||
scc::sc_register<div_t> div;
|
||||
|
||||
|
||||
uart_regs(sc_core::sc_module_name nm);
|
||||
|
||||
template <unsigned BUSWIDTH = 32> void registerResources(scc::tlm_target<BUSWIDTH> &target);
|
||||
template<unsigned BUSWIDTH=32>
|
||||
void registerResources(scc::tlm_target<BUSWIDTH>& target);
|
||||
};
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@ -107,9 +111,12 @@ inline sysc::uart_regs::uart_regs(sc_core::sc_module_name nm)
|
||||
, NAMED(rxctrl, r_rxctrl, 0, *this)
|
||||
, NAMED(ie, r_ie, 0, *this)
|
||||
, NAMED(ip, r_ip, 0, *this)
|
||||
, NAMED(div, r_div, 0, *this) {}
|
||||
, NAMED(div, r_div, 0, *this)
|
||||
{
|
||||
}
|
||||
|
||||
template <unsigned BUSWIDTH> inline void sysc::uart_regs::registerResources(scc::tlm_target<BUSWIDTH> &target) {
|
||||
template<unsigned BUSWIDTH>
|
||||
inline void sysc::uart_regs::registerResources(scc::tlm_target<BUSWIDTH>& target) {
|
||||
target.addResource(txdata, 0x0UL);
|
||||
target.addResource(rxdata, 0x4UL);
|
||||
target.addResource(txctrl, 0x8UL);
|
||||
|
@ -18,24 +18,34 @@
|
||||
#define _GPIO_H_
|
||||
|
||||
#include "scc/tlm_target.h"
|
||||
#include <sysc/communication/sc_signal_rv_ports.h>
|
||||
|
||||
namespace sysc {
|
||||
|
||||
class gpio_regs;
|
||||
class WsHandler;
|
||||
|
||||
class gpio : public sc_core::sc_module, public scc::tlm_target<> {
|
||||
public:
|
||||
SC_HAS_PROCESS(gpio);
|
||||
sc_core::sc_in<sc_core::sc_time> clk_i;
|
||||
sc_core::sc_in<bool> rst_i;
|
||||
sc_core::sc_inout_rv<32> pins_io;
|
||||
|
||||
gpio(sc_core::sc_module_name nm);
|
||||
virtual ~gpio() override; // need to keep it in source file because of fwd declaration of gpio_regs
|
||||
|
||||
protected:
|
||||
void clock_cb();
|
||||
void reset_cb();
|
||||
void update_pins();
|
||||
void pins_cb();
|
||||
sc_core::sc_time clk;
|
||||
std::unique_ptr<gpio_regs> regs;
|
||||
std::shared_ptr<sysc::WsHandler> handler;
|
||||
|
||||
private:
|
||||
void update_value_reg();
|
||||
};
|
||||
|
||||
} /* namespace sysc */
|
||||
|
@ -48,8 +48,8 @@ public:
|
||||
SiFive::core_complex i_core_complex;
|
||||
scc::router<> i_router;
|
||||
uart i_uart0, i_uart1;
|
||||
spi i_spi;
|
||||
gpio i_gpio;
|
||||
spi i_qspi0, i_qspi1, i_qspi2;
|
||||
gpio i_gpio0;
|
||||
plic i_plic;
|
||||
aon i_aon;
|
||||
prci i_prci;
|
||||
@ -59,8 +59,9 @@ public:
|
||||
scc::memory<128_kB, 32> i_mem_ram;
|
||||
sc_core::sc_signal<sc_core::sc_time> s_clk;
|
||||
sc_core::sc_signal<bool> s_rst, s_mtime_int, s_msie_int;
|
||||
sc_core::sc_vector<sc_core::sc_signal<bool>> s_global_int;
|
||||
sc_core::sc_vector<sc_core::sc_signal<bool>> s_global_int, s_local_int;
|
||||
sc_core::sc_signal<bool> s_core_int;
|
||||
sc_core::sc_signal_rv<32> s_gpio_pins;
|
||||
|
||||
platform(sc_core::sc_module_name nm);
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
namespace sysc {
|
||||
|
||||
class uart_regs;
|
||||
class WsHandler;
|
||||
|
||||
class uart : public sc_core::sc_module, public scc::tlm_target<> {
|
||||
public:
|
||||
@ -38,6 +39,7 @@ protected:
|
||||
sc_core::sc_time clk;
|
||||
std::unique_ptr<uart_regs> regs;
|
||||
std::vector<uint8_t> queue;
|
||||
std::shared_ptr<sysc::WsHandler> handler;
|
||||
};
|
||||
|
||||
} /* namespace sysc */
|
||||
|
Reference in New Issue
Block a user