diff --git a/.cproject b/.cproject
index 6d3e745..78164e6 100644
--- a/.cproject
+++ b/.cproject
@@ -163,7 +163,6 @@
make
-
all
true
true
@@ -171,12 +170,19 @@
make
-
all VERBOSE=1
true
true
true
+
+ make
+
+ clean
+ true
+ true
+ true
+
diff --git a/examples/simple_system/CMakeLists.txt b/examples/simple_system/CMakeLists.txt
index 85187ce..5f27cb2 100644
--- a/examples/simple_system/CMakeLists.txt
+++ b/examples/simple_system/CMakeLists.txt
@@ -26,7 +26,6 @@ add_executable (simple_system
sc_main.cpp
)
-
# Link the executable to the sc_components library. Since the sc_components library has
# public include directories we will use those link directories when building
# simple_system
diff --git a/examples/simple_system/gen/gpio_regs.h b/examples/simple_system/gen/gpio_regs.h
index 2657454..95822f8 100644
--- a/examples/simple_system/gen/gpio_regs.h
+++ b/examples/simple_system/gen/gpio_regs.h
@@ -19,18 +19,16 @@
#include
#include
-#include
#include
+#include
namespace sysc {
-template
class gpio_regs :
public sc_core::sc_module,
- public sysc::tlm_target,
public sysc::resetable
- {
-protected:
+{
+public:
// storage declarations
uint32_t r_value;
@@ -86,17 +84,19 @@ protected:
sysc::sc_register out_xor;
gpio_regs(sc_core::sc_module_name nm);
-protected:
- sc_core::sc_time clk;
+
+ template
+ void registerResources(sysc::tlm_target& target);
+
};
+}
+
//////////////////////////////////////////////////////////////////////////////
// member functions
//////////////////////////////////////////////////////////////////////////////
-template
-gpio_regs::gpio_regs(sc_core::sc_module_name nm)
+inline sysc::gpio_regs::gpio_regs(sc_core::sc_module_name nm)
: sc_core::sc_module(nm)
-, sysc::tlm_target(clk)
, NAMED(value, r_value, 0, *this)
, NAMED(input_en, r_input_en, 0, *this)
, NAMED(output_en, r_output_en, 0, *this)
@@ -115,24 +115,27 @@ gpio_regs::gpio_regs(sc_core::sc_module_name nm)
, NAMED(iof_sel, r_iof_sel, 0, *this)
, NAMED(out_xor, r_out_xor, 0, *this)
{
- this->socket_map.addEntry(&value, 0x0UL, 0x4UL);
- this->socket_map.addEntry(&input_en, 0x4UL, 0x4UL);
- this->socket_map.addEntry(&output_en, 0x8UL, 0x4UL);
- this->socket_map.addEntry(&port, 0xcUL, 0x4UL);
- this->socket_map.addEntry(&pue, 0x10UL, 0x4UL);
- this->socket_map.addEntry(&ds, 0x14UL, 0x4UL);
- this->socket_map.addEntry(&rise_ie, 0x18UL, 0x4UL);
- this->socket_map.addEntry(&rise_ip, 0x1cUL, 0x4UL);
- this->socket_map.addEntry(&fall_ie, 0x20UL, 0x4UL);
- this->socket_map.addEntry(&fall_ip, 0x24UL, 0x4UL);
- this->socket_map.addEntry(&high_ie, 0x28UL, 0x4UL);
- this->socket_map.addEntry(&high_ip, 0x2cUL, 0x4UL);
- this->socket_map.addEntry(&low_ie, 0x30UL, 0x4UL);
- this->socket_map.addEntry(&low_ip, 0x34UL, 0x4UL);
- this->socket_map.addEntry(&iof_en, 0x38UL, 0x4UL);
- this->socket_map.addEntry(&iof_sel, 0x3cUL, 0x4UL);
- this->socket_map.addEntry(&out_xor, 0x40UL, 0x4UL);
}
-
+
+template
+inline void sysc::gpio_regs::registerResources(sysc::tlm_target& target) {
+ target.addResource(value, 0x0UL, 0x4UL);
+ target.addResource(input_en, 0x4UL, 0x4UL);
+ target.addResource(output_en, 0x8UL, 0x4UL);
+ target.addResource(port, 0xcUL, 0x4UL);
+ target.addResource(pue, 0x10UL, 0x4UL);
+ target.addResource(ds, 0x14UL, 0x4UL);
+ target.addResource(rise_ie, 0x18UL, 0x4UL);
+ target.addResource(rise_ip, 0x1cUL, 0x4UL);
+ target.addResource(fall_ie, 0x20UL, 0x4UL);
+ target.addResource(fall_ip, 0x24UL, 0x4UL);
+ target.addResource(high_ie, 0x28UL, 0x4UL);
+ target.addResource(high_ip, 0x2cUL, 0x4UL);
+ target.addResource(low_ie, 0x30UL, 0x4UL);
+ target.addResource(low_ip, 0x34UL, 0x4UL);
+ target.addResource(iof_en, 0x38UL, 0x4UL);
+ target.addResource(iof_sel, 0x3cUL, 0x4UL);
+ target.addResource(out_xor, 0x40UL, 0x4UL);
}
+
#endif // _GPIO_REGS_H_
diff --git a/examples/simple_system/gen/spi_regs.h b/examples/simple_system/gen/spi_regs.h
index 0d786c3..ea2be8c 100644
--- a/examples/simple_system/gen/spi_regs.h
+++ b/examples/simple_system/gen/spi_regs.h
@@ -19,8 +19,8 @@
#include
#include
-#include
#include
+#include
namespace sysc {
diff --git a/examples/simple_system/gen/uart_regs.h b/examples/simple_system/gen/uart_regs.h
index 8e2f4d6..fffbfb4 100644
--- a/examples/simple_system/gen/uart_regs.h
+++ b/examples/simple_system/gen/uart_regs.h
@@ -19,8 +19,8 @@
#include
#include
-#include
#include
+#include
namespace sysc {
diff --git a/examples/simple_system/gpio.cpp b/examples/simple_system/gpio.cpp
index 19936a8..3025af2 100644
--- a/examples/simple_system/gpio.cpp
+++ b/examples/simple_system/gpio.cpp
@@ -15,22 +15,35 @@
////////////////////////////////////////////////////////////////////////////////
#include "gpio.h"
+#include "gen/gpio_regs.h"
+#include "sysc/utilities.h"
namespace sysc {
gpio::gpio(sc_core::sc_module_name nm)
-: gpio_regs<>(nm)
+: sc_core::sc_module(nm)
+, tlm_target<>(clk)
, NAMED(clk_i)
+, NAMEDD(gpio_regs, regs)
{
+ regs->registerResources(*this);
SC_METHOD(clock_cb);
sensitive<clk=clk_i.read();
+}
+
+void gpio::reset_cb() {
+ if(rst_i.read())
+ regs->reset_start();
+ else
+ regs->reset_stop();
}
} /* namespace sysc */
diff --git a/examples/simple_system/gpio.h b/examples/simple_system/gpio.h
index ceff146..47e4644 100644
--- a/examples/simple_system/gpio.h
+++ b/examples/simple_system/gpio.h
@@ -17,18 +17,24 @@
#ifndef _GPIO_H_
#define _GPIO_H_
-#include "gen/gpio_regs.h"
+#include
namespace sysc {
-class gpio: public gpio_regs<> {
+class gpio_regs;
+
+class gpio: public sc_core::sc_module, public tlm_target<> {
public:
SC_HAS_PROCESS(gpio);
sc_core::sc_in clk_i;
+ sc_core::sc_in rst_i;
gpio(sc_core::sc_module_name nm);
virtual ~gpio();
protected:
void clock_cb();
+ void reset_cb();
+ sc_core::sc_time clk;
+ std::unique_ptr regs;
};
} /* namespace sysc */
diff --git a/examples/simple_system/sc_main.cpp b/examples/simple_system/sc_main.cpp
index 5e6d367..717be53 100644
--- a/examples/simple_system/sc_main.cpp
+++ b/examples/simple_system/sc_main.cpp
@@ -22,8 +22,11 @@
#include "simple_system.h"
#include
-#include "sysc/scv_tr_db.h"
+#include
+#include
#include
+#include
+#include
using namespace sysc;
namespace po = boost::program_options;
@@ -35,6 +38,8 @@ const size_t ERROR_UNHANDLED_EXCEPTION = 2;
} // namespace
int sc_main(int argc, char* argv[]){
+// sc_report_handler::set_handler(my_report_handler);
+ sysc::Logger::reporting_level()=log::DEBUG;
///////////////////////////////////////////////////////////////////////////
// CLI argument parsing
///////////////////////////////////////////////////////////////////////////
@@ -66,11 +71,13 @@ int sc_main(int argc, char* argv[]){
// instantiate top level
///////////////////////////////////////////////////////////////////////////
simple_system i_simple_system("i_simple_system");
+ //sr_report_handler::add_sc_object_to_filter(&i_simple_system.i_master, sc_core::SC_WARNING, sc_core::SC_MEDIUM);
+
///////////////////////////////////////////////////////////////////////////
// run simulation
///////////////////////////////////////////////////////////////////////////
sc_start(sc_core::sc_time(100, sc_core::SC_NS));
-
+ if(!sc_end_of_simulation_invoked()) sc_stop();
return 0;
}
diff --git a/examples/simple_system/simple_system.cpp b/examples/simple_system/simple_system.cpp
index f1dbbb6..ddc99bb 100644
--- a/examples/simple_system/simple_system.cpp
+++ b/examples/simple_system/simple_system.cpp
@@ -32,6 +32,7 @@ simple_system::simple_system(sc_core::sc_module_name nm)
, NAMED(i_spi)
, NAMED(i_gpio)
, NAMED(s_clk)
+, NAMED(s_rst)
{
i_master.intor(i_router.target[0]);
size_t i=0;
@@ -43,10 +44,17 @@ simple_system::simple_system(sc_core::sc_module_name nm)
i_uart.clk_i(s_clk);
i_spi.clk_i(s_clk);
i_gpio.clk_i(s_clk);
- s_clk.write(sc_core::sc_time(10, sc_core::SC_NS));
+ s_clk.write(10_ns);
+ i_gpio.rst_i(s_rst);
+ i_master.rst_i(s_rst);
+
+ SC_THREAD(gen_reset);
}
-simple_system::~simple_system() {
+void simple_system::gen_reset() {
+ s_rst=true;
+ wait(10_ns);
+ s_rst=false;
}
} /* namespace sysc */
diff --git a/examples/simple_system/simple_system.h b/examples/simple_system/simple_system.h
index 51b6514..f91d8aa 100644
--- a/examples/simple_system/simple_system.h
+++ b/examples/simple_system/simple_system.h
@@ -37,15 +37,19 @@ namespace sysc {
class simple_system: public sc_core::sc_module {
public:
+ SC_HAS_PROCESS(simple_system);
+
test_initiator i_master;
router<> i_router;
uart i_uart;
spi i_spi;
gpio i_gpio;
sc_core::sc_signal s_clk;
+ sc_core::sc_signal s_rst;
simple_system(sc_core::sc_module_name nm);
- virtual ~simple_system();
+protected:
+ void gen_reset();
#include "gen/e300_plat_t.h"
};
diff --git a/examples/simple_system/test_initiator.cpp b/examples/simple_system/test_initiator.cpp
index f065c41..0d7f51f 100644
--- a/examples/simple_system/test_initiator.cpp
+++ b/examples/simple_system/test_initiator.cpp
@@ -21,6 +21,7 @@
*/
#include "test_initiator.h"
+#include
#include
#include
@@ -29,15 +30,19 @@ namespace sysc {
test_initiator::test_initiator(sc_core::sc_module_name nm)
: sc_core::sc_module(nm)
, NAMED(intor)
+, NAMED(rst_i)
{
SC_THREAD(run);
}
void test_initiator::run() {
- wait(10, sc_core::SC_NS);
+ if(rst_i.read()==false) wait(rst_i.posedge_event());
+ wait(rst_i.negedge_event());
+ wait(10_ns);
tlm::tlm_generic_payload gp;
std::array data;
+ srInfo()("group", "comm")("read access");
gp.set_command(tlm::TLM_READ_COMMAND);
gp.set_address(0x10012000);
gp.set_data_ptr(data.data());
@@ -45,7 +50,13 @@ void test_initiator::run() {
gp.set_streaming_width(4);
sc_core::sc_time delay;
intor->b_transport(gp, delay);
- wait(10, sc_core::SC_NS);
+ wait(10_ns);
+ srWarn()("group", "comm")("write access");
+ gp.set_command(tlm::TLM_WRITE_COMMAND);
+ gp.set_address(0x10012000);
+ data[0]=0xA5;
+ intor->b_transport(gp, delay);
+ wait(10_ns);
}
} /* namespace sysc */
diff --git a/examples/simple_system/test_initiator.h b/examples/simple_system/test_initiator.h
index 300c622..f3e166a 100644
--- a/examples/simple_system/test_initiator.h
+++ b/examples/simple_system/test_initiator.h
@@ -23,8 +23,8 @@
#ifndef _TEST_INITIATOR_H_
#define _TEST_INITIATOR_H_
+#include
#include
-#include
namespace sysc {
@@ -33,6 +33,7 @@ public:
SC_HAS_PROCESS(test_initiator);
tlm_utils::simple_initiator_socket intor;
+ sc_core::sc_in rst_i;
test_initiator(sc_core::sc_module_name nm);
protected:
void run();
diff --git a/sc-components b/sc-components
index 5f7387a..48428f0 160000
--- a/sc-components
+++ b/sc-components
@@ -1 +1 @@
-Subproject commit 5f7387ab7e3dfc2ff6a7cac6fbe834ed7ec8ae36
+Subproject commit 48428f097659421db15d1eeac3a74fdd653db6e5