Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
timurkelin committed Jan 7, 2020
0 parents commit f6e0051
Show file tree
Hide file tree
Showing 19 changed files with 2,203 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# internal and intermediate data
/int/
/morgue/

# Eclipse directories and files
/.settings/
/.cproject
/.project
/*.mat

# Build directories
/build/

# Office lock files
/doc/~*
/doc/.~*

# Generated files
*.log
*.out
*.vcd
*.m~




21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 Timur Kelin

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# cosim
Co-simulation of the simSCHD static scheduler and simSIMD vector processor

### Block Diagram of the Simulation Platform
![alt text](https://github.com/timurkelin/cosim/blob/master/doc/block_diagram.PNG)
5 changes: 5 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
theme:
- jekyll-theme-minimal

plugins:
- jekyll-sitemap
70 changes: 70 additions & 0 deletions cosim_common/include/cosim_adapter.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/*
* cosim_adapter.h
*
* Description:
* Declaration of the system component:
* SCHD<->SIMD adapter for co-simulation
*/

#ifndef COSIM_COMMON_INCLUDE_COSIM_ADAPTER_H_
#define COSIM_COMMON_INCLUDE_COSIM_ADAPTER_H_

#include <string>
#include <boost/property_tree/ptree.hpp>
#include <boost/optional/optional.hpp>
#include <systemc>
#include "schd_sig_ptree.h"
#include "simd_sig_ptree.h"

// Short alias for the namespace
namespace boost_pt = boost::property_tree;

namespace schd {

SC_MODULE( cosim_adapter_c ) { // declare module class

public:
// ports to be connected to SIMD core
sc_core::sc_in<bool> clock_i; // Clock
sc_core::sc_in<bool> reset_i; // Reset
sc_core::sc_port<sc_core::sc_fifo_in_if< simd::simd_sig_ptree_c>> event_i; // SIMD Interrupt request fifo export through the input interface
sc_core::sc_port<sc_core::sc_fifo_out_if<simd::simd_sig_ptree_c>> busw_o; // SIMD Config output
sc_core::sc_port<sc_core::sc_fifo_in_if< simd::simd_sig_ptree_c>> busr_i; // SIMD Status input

// ports to be connected to SCHD planner (via router)
sc_core::sc_export<sc_core::sc_fifo_in_if <schd::schd_sig_ptree_c>> plan_ei;
sc_core::sc_export<sc_core::sc_fifo_out_if<schd::schd_sig_ptree_c>> plan_eo;

// Constructor declaration
SC_CTOR( cosim_adapter_c );

// Init/config declaration
void init(
boost::optional<const boost_pt::ptree&> schd_exec_p, // SCHD exec preferences
boost::optional<const boost_pt::ptree&> simd_core_p ); // SIMD core preferences

private:
// Process declarations
void exec_thrd(
void );

// Channels
sc_core::sc_fifo<schd_sig_ptree_c> chn_adap_plan;
sc_core::sc_fifo<schd_sig_ptree_c> chn_plan_adap;

static const int chn_adap_plan_size = 64;
static const int chn_plan_adap_size = 64;

class exec_data_t {
public:
std::list<boost_pt::ptree> exec_pt; // pt for dmeu/xbar/run
bool tx_active = false; // this branch is being transmitted
};

typedef std::map<std::size_t, exec_data_t> exec_list_t; // hash(thread+task) is used as a key

exec_list_t exec_list;
};
}

#endif /* COSIM_COMMON_INCLUDE_COSIM_ADAPTER_H_ */
71 changes: 71 additions & 0 deletions cosim_common/src/cosim_adapter.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/*
* cosim_adapter.cpp
*
* Description: SCHD<->SIMD adapter for co-simulation
*/

#include <boost/random.hpp>
#include "cosim_adapter.h"
#include "schd_assert.h"
#include "schd_report.h"

namespace schd {

SC_HAS_PROCESS( schd::cosim_adapter_c );
cosim_adapter_c::cosim_adapter_c(
sc_core::sc_module_name nm )
: sc_core::sc_module( nm )
, clock_i( "clock_i" )
, reset_i( "reset_i" )
, event_i( "event_i" )
, busw_o( "busw_o" )
, busr_i( "busr_i" )
, plan_ei( "plan_ei" )
, plan_eo( "plan_eo" )
, chn_adap_plan( "chn_adap_plan", chn_adap_plan_size )
, chn_plan_adap( "chn_plan_adap", chn_plan_adap_size ) {

// Process registrations
SC_CTHREAD( exec_thrd, clock_i.pos() ); // Synchronous thread for data processing
reset_signal_is( reset_i, true );
} // cosim_adapter_c::cosim_adapter_c(

void cosim_adapter_c::init(
boost::optional<const boost_pt::ptree&> schd_exec_p, // SCHD exec preferences
boost::optional<const boost_pt::ptree&> simd_core_p ) { // SIMD core preferences

// Extract names of the simd core modules

// Extract names of the schd exec blocks which correspond to simd
BOOST_FOREACH( const boost_pt::ptree::value_type& exec_el, _exec_p.get()) {
if( !exec_el.first.empty()) {
SCHD_REPORT_ERROR( "schd::plan" ) << name() << " Incorrect exec structure";
}

boost::optional<std::string> name_p = exec_el.second.get_optional<std::string>("name");

if( !name_p.is_initialized()) {
SCHD_REPORT_ERROR( "schd::plan" ) << name() << " Incorrect exec structure";
}

// Initialize exec data
exec_data_t exec_data;

exec_list.emplace( std::make_pair( name_p.get(), exec_data ));
} // BOOST_FOREACH( const boost_pt::ptree::value_type& exec_el, _exec_p.get())


// Connect fifo channels with the corresponding exports
plan_eo.bind( chn_plan_adap );
plan_ei.bind( chn_adap_plan );
} // void cosim_adapter_c::init(

void cosim_adapter_c::exec_thrd(
void ) {

for(;;) {
sc_core::wait();
} // for(;;)
} // void cosim_adapter_c::exec_thrd(

} // namespace schd
Loading

0 comments on commit f6e0051

Please sign in to comment.