Added SystemC version of HiFive FE310
This commit is contained in:
@ -1,173 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (C) 2017, MINRES Technologies GmbH
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Contributors:
|
||||
* eyck@minres.com - initial API and implementation
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef _CLI_OPTIONS_H_
|
||||
#define _CLI_OPTIONS_H_
|
||||
#include <boost/program_options.hpp>
|
||||
#include <cstdio>
|
||||
#include <iostream>
|
||||
#include <util/logging.h>
|
||||
|
||||
namespace {
|
||||
const size_t ERROR_IN_COMMAND_LINE = 1;
|
||||
const size_t SUCCESS = 0;
|
||||
const size_t ERROR_UNHANDLED_EXCEPTION = 2;
|
||||
|
||||
inline void enable_log_level(int level) {
|
||||
switch (level) {
|
||||
case 0:
|
||||
logging::Logger::reporting_level() = logging::FATAL;
|
||||
/* no break */
|
||||
case 1:
|
||||
logging::Logger::reporting_level() = logging::ERROR;
|
||||
/* no break */
|
||||
case 2:
|
||||
logging::Logger::reporting_level() = logging::WARNING;
|
||||
/* no break */
|
||||
case 3:
|
||||
logging::Logger::reporting_level() = logging::INFO;
|
||||
/* no break */
|
||||
case 4:
|
||||
logging::Logger::reporting_level() = logging::DEBUG;
|
||||
/* no break */
|
||||
case 5:
|
||||
logging::Logger::reporting_level() = logging::TRACE;
|
||||
/* no break */
|
||||
}
|
||||
}
|
||||
|
||||
inline void configure_default_logger(boost::program_options::variables_map &vm) {
|
||||
// el::Configurations defaultConf;
|
||||
// defaultConf.setToDefault();
|
||||
// defaultConf.set(el::Level::Error, el::ConfigurationType::Format,
|
||||
//"%datetime{%H:%m:%s.%g} %level %msg");
|
||||
// defaultConf.set(el::Level::Warning, el::ConfigurationType::Format,
|
||||
//"%datetime{%H:%m:%s.%g} %level %msg");
|
||||
// defaultConf.set(el::Level::Info, el::ConfigurationType::Format,
|
||||
//"%datetime{%H:%m:%s.%g} %level %msg");
|
||||
// defaultConf.set(el::Level::Debug, el::ConfigurationType::Format,
|
||||
//"%datetime{%H:%m:%s.%g} %level %msg");
|
||||
// defaultConf.set(el::Level::Trace, el::ConfigurationType::Format,
|
||||
//"%datetime{%H:%m:%s.%g} %level %msg");
|
||||
if (vm.count("verbose")) enable_log_level(vm["verbose"].as<int>());
|
||||
if (vm.count("log-file")) logging::Output2FILE::stream() = fopen(vm["log-file"].as<std::string>().c_str(), "w");
|
||||
// default logger uses default configurations
|
||||
// el::Loggers::reconfigureLogger("default", defaultConf);
|
||||
}
|
||||
|
||||
inline void configure_debugger_logger() {
|
||||
// configure the connection logger
|
||||
// el::Logger* gdbServerLogger = el::Loggers::getLogger(connection);
|
||||
// el::Configurations gdbServerConf;
|
||||
// gdbServerConf.setToDefault();
|
||||
// gdbServerConf.set(el::Level::Error, el::ConfigurationType::Format,
|
||||
// "%datetime{%H:%m:%s.%g} %level [%logger] %msg");
|
||||
// gdbServerConf.set(el::Level::Warning, el::ConfigurationType::Format,
|
||||
// "%datetime{%H:%m:%s.%g} %level [%logger] %msg");
|
||||
// gdbServerConf.set(el::Level::Info, el::ConfigurationType::Format,
|
||||
// "%datetime{%H:%m:%s.%g} %level [%logger] %msg");
|
||||
// gdbServerConf.set(el::Level::Debug, el::ConfigurationType::Format,
|
||||
// "%datetime{%H:%m:%s.%g} %level [%logger] %msg");
|
||||
// gdbServerConf.set(el::Level::Trace, el::ConfigurationType::Format,
|
||||
// "%datetime{%H:%m:%s.%g} %level [%logger] %msg");
|
||||
// enable_log_level(gdbServerConf, 5);
|
||||
// gdbServerLogger->configure(gdbServerConf);
|
||||
}
|
||||
|
||||
inline void configure_disass_logger(boost::program_options::variables_map &vm) {
|
||||
// el::Logger* disassLogger = el::Loggers::getLogger(disass);
|
||||
// el::Configurations disassConf;
|
||||
// if(vm.count(disass)){
|
||||
// auto file_name=vm[disass].as<std::string>();
|
||||
// disassConf.setToDefault();
|
||||
// if (file_name.length() > 0) {
|
||||
// disassConf.set(el::Level::Global, el::ConfigurationType::ToFile,
|
||||
// std::string("true"));
|
||||
// disassConf.set(el::Level::Global,
|
||||
// el::ConfigurationType::ToStandardOutput,
|
||||
// std::string("false"));
|
||||
// disassConf.set(el::Level::Global, el::ConfigurationType::Format,
|
||||
// std::string("%msg"));
|
||||
// disassConf.set(el::Level::Global,
|
||||
// el::ConfigurationType::Filename,
|
||||
// file_name);
|
||||
// std::ofstream str(file_name); // just to clear the file
|
||||
// } else {
|
||||
// disassConf.set(el::Level::Global, el::ConfigurationType::Format,
|
||||
// "%datetime{%H:%m:%s.%g} [%logger] %msg");
|
||||
// }
|
||||
// } else {
|
||||
// enable_log_level(disassConf, 0);
|
||||
// }
|
||||
// disassLogger->configure(disassConf);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
inline int parse_cli_options(boost::program_options::variables_map &vm, int argc, char *argv[]) {
|
||||
namespace po = boost::program_options;
|
||||
po::options_description desc("Options");
|
||||
desc.add_options()("help,h", "Print help message")("verbose,v", po::value<int>()->implicit_value(0),
|
||||
"Sets logging verbosity")("vmodule", po::value<std::string>(),
|
||||
"Defines the module(s) to be logged")(
|
||||
"logging-flags", po::value<int>(), "Sets logging flag(s).")("log-file", po::value<std::string>(),
|
||||
"Sets default log file.")(
|
||||
"disass,d", po::value<std::string>()->implicit_value(""),
|
||||
"Enables disassembly")("elf,l", po::value<std::vector<std::string>>(), "ELF file(s) to load")(
|
||||
"gdb-port,g", po::value<unsigned>(), "enable gdb server and specify port to use")(
|
||||
"input,i", po::value<std::string>(), "the elf file to load (instead of hex files)")(
|
||||
"dump-ir", "dump the intermediate representation")("cycles,c", po::value<int64_t>()->default_value(-1),
|
||||
"number of cycles to run")(
|
||||
"systemc,s", "Run as SystemC simulation")("time", po::value<int>(), "SystemC siimulation time in ms")(
|
||||
"reset,r", po::value<std::string>(), "reset address")(
|
||||
"trace", po::value<uint8_t>(), "enable tracing, or cmbintation of 1=signals and 2=TX text, 4=TX "
|
||||
"compressed text, 6=TX in SQLite")("mem,m", po::value<std::string>(),
|
||||
"the memory input file")("rv64", "run RV64");
|
||||
try {
|
||||
po::store(po::parse_command_line(argc, argv, desc), vm); // can throw
|
||||
// --help option
|
||||
if (vm.count("help")) {
|
||||
std::cout << "DBT-RISE-RiscV" << std::endl << desc << std::endl;
|
||||
return SUCCESS;
|
||||
}
|
||||
po::notify(vm); // throws on error, so do after help in case
|
||||
} catch (po::error &e) {
|
||||
// there are problems
|
||||
std::cerr << "ERROR: " << e.what() << std::endl << std::endl;
|
||||
std::cerr << desc << std::endl;
|
||||
return ERROR_IN_COMMAND_LINE;
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
#endif /* _CLI_OPTIONS_H_ */
|
43
riscv.sc/incl/sysc/SiFive/aon.h
Normal file
43
riscv.sc/incl/sysc/SiFive/aon.h
Normal file
@ -0,0 +1,43 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2017 eyck@minres.com
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef _AON_H_
|
||||
#define _AON_H_
|
||||
|
||||
#include <sysc/tlm_target.h>
|
||||
|
||||
namespace sysc {
|
||||
|
||||
class aon_regs;
|
||||
|
||||
class aon : public sc_core::sc_module, public tlm_target<> {
|
||||
public:
|
||||
SC_HAS_PROCESS(aon);
|
||||
sc_core::sc_in<sc_core::sc_time> clk_i;
|
||||
sc_core::sc_in<bool> rst_i;
|
||||
aon(sc_core::sc_module_name nm);
|
||||
virtual ~aon() override; // need to keep it in source file because of fwd declaration of aon_regs
|
||||
|
||||
protected:
|
||||
void clock_cb();
|
||||
void reset_cb();
|
||||
sc_core::sc_time clk;
|
||||
std::unique_ptr<aon_regs> regs;
|
||||
};
|
||||
|
||||
} /* namespace sysc */
|
||||
|
||||
#endif /* _GPIO_H_ */
|
57
riscv.sc/incl/sysc/SiFive/clint.h
Normal file
57
riscv.sc/incl/sysc/SiFive/clint.h
Normal file
@ -0,0 +1,57 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2017 eyck@minres.com
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef _CLINT_H_
|
||||
#define _CLINT_H_
|
||||
|
||||
#include <sysc/tlm_target.h>
|
||||
|
||||
namespace iss {
|
||||
namespace arch {
|
||||
template <typename BASE> struct riscv_hart_msu_vp;
|
||||
}
|
||||
}
|
||||
|
||||
namespace sysc {
|
||||
|
||||
class clint_regs;
|
||||
namespace SiFive {
|
||||
class core_complex;
|
||||
}
|
||||
|
||||
class clint : public sc_core::sc_module, public tlm_target<> {
|
||||
public:
|
||||
SC_HAS_PROCESS(clint);
|
||||
sc_core::sc_in<sc_core::sc_time> clk_i;
|
||||
sc_core::sc_in<bool> rst_i;
|
||||
sc_core::sc_out<bool> mtime_int_o;
|
||||
sc_core::sc_out<bool> msip_int_o;
|
||||
clint(sc_core::sc_module_name nm);
|
||||
virtual ~clint() override; // need to keep it in source file because of fwd declaration of clint_regs
|
||||
|
||||
protected:
|
||||
void clock_cb();
|
||||
void reset_cb();
|
||||
void update_mtime();
|
||||
sc_core::sc_time clk, last_updt;
|
||||
unsigned cnt_fraction;
|
||||
std::unique_ptr<clint_regs> regs;
|
||||
sc_core::sc_event mtime_evt;
|
||||
};
|
||||
|
||||
} /* namespace sysc */
|
||||
|
||||
#endif /* _CLINT_H_ */
|
@ -37,21 +37,89 @@
|
||||
#ifndef _SYSC_SIFIVE_FE310_H_
|
||||
#define _SYSC_SIFIVE_FE310_H_
|
||||
|
||||
#include <iss/arch/riscv_hart_msu_vp.h>
|
||||
#include <iss/arch/rv32imac.h>
|
||||
#include <sysc/ext_attribute.h>
|
||||
#include <sysc/initiator_mixin.h>
|
||||
#include <sysc/traceable.h>
|
||||
#include <sysc/utilities.h>
|
||||
#include <tlm>
|
||||
#include <tlm_utils/tlm_quantumkeeper.h>
|
||||
#include <util/range_lut.h>
|
||||
|
||||
namespace iss {
|
||||
class vm_if;
|
||||
namespace arch {
|
||||
template <typename BASE> struct riscv_hart_msu_vp;
|
||||
}
|
||||
}
|
||||
|
||||
namespace sysc {
|
||||
namespace SiFive {
|
||||
|
||||
class core_complex : public iss::arch::riscv_hart_msu_vp<iss::arch::rv32imac>, public sc_core::sc_module {
|
||||
class tlm_dmi_ext : public tlm::tlm_dmi {
|
||||
public:
|
||||
tlm::tlm_initiator_socket<32> initiator;
|
||||
bool operator==(const tlm_dmi_ext &o) const {
|
||||
return this->get_granted_access() == o.get_granted_access() &&
|
||||
this->get_start_address() == o.get_start_address() && this->get_end_address() == o.get_end_address();
|
||||
}
|
||||
|
||||
bool operator!=(const tlm_dmi_ext &o) const { return !operator==(o); }
|
||||
};
|
||||
|
||||
namespace SiFive {
|
||||
class core_wrapper;
|
||||
|
||||
class core_complex : public sc_core::sc_module, public sysc::traceable {
|
||||
public:
|
||||
SC_HAS_PROCESS(core_complex);
|
||||
|
||||
sysc::initiator_mixin<tlm::tlm_initiator_socket<32>> initiator;
|
||||
|
||||
sc_core::sc_in<sc_core::sc_time> clk_i;
|
||||
|
||||
sc_core::sc_in<bool> rst_i;
|
||||
|
||||
sysc::ext_attribute<std::string> elf_file;
|
||||
|
||||
sysc::ext_attribute<bool> enable_disass;
|
||||
|
||||
sysc::ext_attribute<uint64_t> reset_address;
|
||||
|
||||
sysc::ext_attribute<unsigned short> gdb_server_port;
|
||||
|
||||
sysc::ext_attribute<bool> dump_ir;
|
||||
|
||||
core_complex(sc_core::sc_module_name name);
|
||||
virtual ~core_complex() = default;
|
||||
|
||||
~core_complex();
|
||||
|
||||
inline void sync() {
|
||||
quantum_keeper.inc(curr_clk);
|
||||
if (quantum_keeper.need_sync()) {
|
||||
wait(quantum_keeper.get_local_time());
|
||||
quantum_keeper.reset();
|
||||
}
|
||||
}
|
||||
|
||||
bool read_mem(uint64_t addr, unsigned length, uint8_t *const data);
|
||||
|
||||
bool write_mem(uint64_t addr, unsigned length, const uint8_t *const data);
|
||||
|
||||
bool read_mem_dbg(uint64_t addr, unsigned length, uint8_t *const data);
|
||||
|
||||
bool write_mem_dbg(uint64_t addr, unsigned length, const uint8_t *const data);
|
||||
|
||||
void trace(sc_core::sc_trace_file *trf) override;
|
||||
|
||||
protected:
|
||||
void before_end_of_elaboration();
|
||||
void start_of_simulation();
|
||||
void run();
|
||||
void clk_cb();
|
||||
util::range_lut<tlm_dmi_ext> read_lut, write_lut;
|
||||
tlm_utils::tlm_quantumkeeper quantum_keeper;
|
||||
std::vector<uint8_t> write_buf;
|
||||
std::unique_ptr<core_wrapper> cpu;
|
||||
std::unique_ptr<iss::vm_if> vm;
|
||||
sc_core::sc_time curr_clk;
|
||||
};
|
||||
|
||||
} /* namespace SiFive */
|
||||
|
173
riscv.sc/incl/sysc/SiFive/gen/aon_regs.h
Normal file
173
riscv.sc/incl/sysc/SiFive/gen/aon_regs.h
Normal file
@ -0,0 +1,173 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2017, MINRES Technologies GmbH
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
// may be used to endorse or promote products derived from this software
|
||||
// without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// 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
|
||||
// * aon_regs.h Author: <RDL Generator>
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _AON_REGS_H_
|
||||
#define _AON_REGS_H_
|
||||
|
||||
#include <sysc/register.h>
|
||||
#include <sysc/tlm_target.h>
|
||||
#include <sysc/utilities.h>
|
||||
#include <util/bit_field.h>
|
||||
|
||||
namespace sysc {
|
||||
|
||||
class aon_regs : public sc_core::sc_module, public sysc::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();
|
||||
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();
|
||||
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
|
||||
sysc::sc_register<uint32_t> wdogcfg;
|
||||
sysc::sc_register<uint32_t> wdogcount;
|
||||
sysc::sc_register<uint32_t> wdogs;
|
||||
sysc::sc_register<uint32_t> wdogfeed;
|
||||
sysc::sc_register<uint32_t> wdogkey;
|
||||
sysc::sc_register<uint32_t> wdogcmp;
|
||||
sysc::sc_register<uint32_t> rtccfg;
|
||||
sysc::sc_register<uint32_t> rtclo;
|
||||
sysc::sc_register<uint32_t> rtchi;
|
||||
sysc::sc_register<uint32_t> rtcs;
|
||||
sysc::sc_register<uint32_t> rtccmp;
|
||||
sysc::sc_register<uint32_t> lfrosccfg;
|
||||
sysc::sc_register_indexed<uint32_t, 32> backup;
|
||||
sysc::sc_register_indexed<pmuwakeupi_t, 8> pmuwakeupi;
|
||||
sysc::sc_register_indexed<pmusleepi_t, 8> pmusleepi;
|
||||
sysc::sc_register<uint32_t> pmuie;
|
||||
sysc::sc_register<uint32_t> pmucause;
|
||||
sysc::sc_register<uint32_t> pmusleep;
|
||||
sysc::sc_register<uint32_t> pmukey;
|
||||
|
||||
aon_regs(sc_core::sc_module_name nm);
|
||||
|
||||
template <unsigned BUSWIDTH = 32> void registerResources(sysc::tlm_target<BUSWIDTH> &target);
|
||||
};
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// member functions
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inline sysc::aon_regs::aon_regs(sc_core::sc_module_name nm)
|
||||
: sc_core::sc_module(nm)
|
||||
, NAMED(wdogcfg, r_wdogcfg, 0, *this)
|
||||
, NAMED(wdogcount, r_wdogcount, 0, *this)
|
||||
, NAMED(wdogs, r_wdogs, 0, *this)
|
||||
, NAMED(wdogfeed, r_wdogfeed, 0, *this)
|
||||
, NAMED(wdogkey, r_wdogkey, 0, *this)
|
||||
, NAMED(wdogcmp, r_wdogcmp, 0, *this)
|
||||
, NAMED(rtccfg, r_rtccfg, 0, *this)
|
||||
, NAMED(rtclo, r_rtclo, 0, *this)
|
||||
, NAMED(rtchi, r_rtchi, 0, *this)
|
||||
, NAMED(rtcs, r_rtcs, 0, *this)
|
||||
, NAMED(rtccmp, r_rtccmp, 0, *this)
|
||||
, NAMED(lfrosccfg, r_lfrosccfg, 0, *this)
|
||||
, NAMED(backup, r_backup, 0, *this)
|
||||
, NAMED(pmuwakeupi, r_pmuwakeupi, 0, *this)
|
||||
, NAMED(pmusleepi, r_pmusleepi, 0, *this)
|
||||
, NAMED(pmuie, r_pmuie, 0, *this)
|
||||
, NAMED(pmucause, r_pmucause, 0, *this)
|
||||
, NAMED(pmusleep, r_pmusleep, 0, *this)
|
||||
, NAMED(pmukey, r_pmukey, 0, *this) {}
|
||||
|
||||
template <unsigned BUSWIDTH> inline void sysc::aon_regs::registerResources(sysc::tlm_target<BUSWIDTH> &target) {
|
||||
target.addResource(wdogcfg, 0x0UL);
|
||||
target.addResource(wdogcount, 0x8UL);
|
||||
target.addResource(wdogs, 0x10UL);
|
||||
target.addResource(wdogfeed, 0x18UL);
|
||||
target.addResource(wdogkey, 0x1cUL);
|
||||
target.addResource(wdogcmp, 0x20UL);
|
||||
target.addResource(rtccfg, 0x40UL);
|
||||
target.addResource(rtclo, 0x48UL);
|
||||
target.addResource(rtchi, 0x4cUL);
|
||||
target.addResource(rtcs, 0x50UL);
|
||||
target.addResource(rtccmp, 0x60UL);
|
||||
target.addResource(lfrosccfg, 0x70UL);
|
||||
target.addResource(backup, 0x80UL);
|
||||
target.addResource(pmuwakeupi, 0x100UL);
|
||||
target.addResource(pmusleepi, 0x120UL);
|
||||
target.addResource(pmuie, 0x140UL);
|
||||
target.addResource(pmucause, 0x144UL);
|
||||
target.addResource(pmusleep, 0x148UL);
|
||||
target.addResource(pmukey, 0x14cUL);
|
||||
}
|
||||
|
||||
#endif // _AON_REGS_H_
|
83
riscv.sc/incl/sysc/SiFive/gen/clint_regs.h
Normal file
83
riscv.sc/incl/sysc/SiFive/gen/clint_regs.h
Normal file
@ -0,0 +1,83 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2017, MINRES Technologies GmbH
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
// may be used to endorse or promote products derived from this software
|
||||
// without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// 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
|
||||
// * clint_regs.h Author: <RDL Generator>
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _CLINT_REGS_H_
|
||||
#define _CLINT_REGS_H_
|
||||
|
||||
#include <sysc/register.h>
|
||||
#include <sysc/tlm_target.h>
|
||||
#include <sysc/utilities.h>
|
||||
#include <util/bit_field.h>
|
||||
|
||||
namespace sysc {
|
||||
|
||||
class clint_regs : public sc_core::sc_module, public sysc::resetable {
|
||||
public:
|
||||
// storage declarations
|
||||
BEGIN_BF_DECL(msip_t, uint32_t);
|
||||
BF_FIELD(msip, 0, 1);
|
||||
END_BF_DECL() r_msip;
|
||||
|
||||
uint64_t r_mtimecmp;
|
||||
|
||||
uint64_t r_mtime;
|
||||
|
||||
// register declarations
|
||||
sysc::sc_register<msip_t> msip;
|
||||
sysc::sc_register<uint64_t> mtimecmp;
|
||||
sysc::sc_register<uint64_t> mtime;
|
||||
|
||||
clint_regs(sc_core::sc_module_name nm);
|
||||
|
||||
template <unsigned BUSWIDTH = 32> void registerResources(sysc::tlm_target<BUSWIDTH> &target);
|
||||
};
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// member functions
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
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) {}
|
||||
|
||||
template <unsigned BUSWIDTH> inline void sysc::clint_regs::registerResources(sysc::tlm_target<BUSWIDTH> &target) {
|
||||
target.addResource(msip, 0x0UL);
|
||||
target.addResource(mtimecmp, 0x4000UL);
|
||||
target.addResource(mtime, 0xbff8UL);
|
||||
}
|
||||
|
||||
#endif // _CLINT_REGS_H_
|
@ -2,11 +2,15 @@
|
||||
#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<sysc::target_memory_map_entry<32>, 4> e300_plat_map = {{
|
||||
{&i_plic, 0xc000000, 0x1000},
|
||||
{&i_gpio, 0x10012000, 0x1000},
|
||||
{&i_uart, 0x10013000, 0x1000},
|
||||
{&i_spi, 0x10014000, 0x1000},
|
||||
const std::array<sysc::target_memory_map_entry<32>, 8> e300_plat_map = {{
|
||||
{&i_clint, 0x2000000, 0xc000},
|
||||
{&i_plic, 0xc000000, 0x200008},
|
||||
{&i_aon, 0x10000000, 0x150},
|
||||
{&i_prci, 0x10008000, 0x14},
|
||||
{&i_gpio, 0x10012000, 0x44},
|
||||
{&i_uart0, 0x10013000, 0x1c},
|
||||
{&i_uart1, 0x10023000, 0x1c},
|
||||
{&i_spi, 0x10014000, 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 Sep 20 11:47:24 CEST 2017
|
||||
// Created on: Wed Oct 04 10:06:35 CEST 2017
|
||||
// * gpio_regs.h Author: <RDL Generator>
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -44,7 +44,7 @@
|
||||
namespace sysc {
|
||||
|
||||
class gpio_regs : public sc_core::sc_module, public sysc::resetable {
|
||||
protected:
|
||||
public:
|
||||
// storage declarations
|
||||
uint32_t r_value;
|
||||
|
||||
@ -99,7 +99,6 @@ protected:
|
||||
sysc::sc_register<uint32_t> iof_sel;
|
||||
sysc::sc_register<uint32_t> out_xor;
|
||||
|
||||
public:
|
||||
gpio_regs(sc_core::sc_module_name nm);
|
||||
|
||||
template <unsigned BUSWIDTH = 32> void registerResources(sysc::tlm_target<BUSWIDTH> &target);
|
||||
|
@ -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 Sep 20 22:30:45 CEST 2017
|
||||
// Created on: Wed Oct 04 10:06:35 CEST 2017
|
||||
// * plic_regs.h Author: <RDL Generator>
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -44,7 +44,7 @@
|
||||
namespace sysc {
|
||||
|
||||
class plic_regs : public sc_core::sc_module, public sysc::resetable {
|
||||
protected:
|
||||
public:
|
||||
// storage declarations
|
||||
BEGIN_BF_DECL(priority_t, uint32_t);
|
||||
BF_FIELD(priority, 0, 3);
|
||||
@ -68,7 +68,6 @@ protected:
|
||||
sysc::sc_register<threshold_t> threshold;
|
||||
sysc::sc_register<uint32_t> claim_complete;
|
||||
|
||||
public:
|
||||
plic_regs(sc_core::sc_module_name nm);
|
||||
|
||||
template <unsigned BUSWIDTH = 32> void registerResources(sysc::tlm_target<BUSWIDTH> &target);
|
||||
@ -90,8 +89,8 @@ template <unsigned BUSWIDTH> inline void sysc::plic_regs::registerResources(sysc
|
||||
target.addResource(priority, 0x4UL);
|
||||
target.addResource(pending, 0x1000UL);
|
||||
target.addResource(enabled, 0x2000UL);
|
||||
target.addResource(threshold, 0xc200000UL);
|
||||
target.addResource(claim_complete, 0xc200004UL);
|
||||
target.addResource(threshold, 0x200000UL);
|
||||
target.addResource(claim_complete, 0x200004UL);
|
||||
}
|
||||
|
||||
#endif // _PLIC_REGS_H_
|
||||
|
107
riscv.sc/incl/sysc/SiFive/gen/prci_regs.h
Normal file
107
riscv.sc/incl/sysc/SiFive/gen/prci_regs.h
Normal file
@ -0,0 +1,107 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2017, MINRES Technologies GmbH
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
// may be used to endorse or promote products derived from this software
|
||||
// without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// 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
|
||||
// * prci_regs.h Author: <RDL Generator>
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _PRCI_REGS_H_
|
||||
#define _PRCI_REGS_H_
|
||||
|
||||
#include <sysc/register.h>
|
||||
#include <sysc/tlm_target.h>
|
||||
#include <sysc/utilities.h>
|
||||
#include <util/bit_field.h>
|
||||
|
||||
namespace sysc {
|
||||
|
||||
class prci_regs : public sc_core::sc_module, public sysc::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);
|
||||
END_BF_DECL() r_hfrosccfg;
|
||||
|
||||
BEGIN_BF_DECL(hfxosccfg_t, uint32_t);
|
||||
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);
|
||||
END_BF_DECL() r_pllcfg;
|
||||
|
||||
uint32_t r_plloutdiv;
|
||||
|
||||
uint32_t r_coreclkcfg;
|
||||
|
||||
// register declarations
|
||||
sysc::sc_register<hfrosccfg_t> hfrosccfg;
|
||||
sysc::sc_register<hfxosccfg_t> hfxosccfg;
|
||||
sysc::sc_register<pllcfg_t> pllcfg;
|
||||
sysc::sc_register<uint32_t> plloutdiv;
|
||||
sysc::sc_register<uint32_t> coreclkcfg;
|
||||
|
||||
prci_regs(sc_core::sc_module_name nm);
|
||||
|
||||
template <unsigned BUSWIDTH = 32> void registerResources(sysc::tlm_target<BUSWIDTH> &target);
|
||||
};
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// member functions
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inline sysc::prci_regs::prci_regs(sc_core::sc_module_name nm)
|
||||
: sc_core::sc_module(nm)
|
||||
, NAMED(hfrosccfg, r_hfrosccfg, 0, *this)
|
||||
, NAMED(hfxosccfg, r_hfxosccfg, 0, *this)
|
||||
, NAMED(pllcfg, r_pllcfg, 0, *this)
|
||||
, NAMED(plloutdiv, r_plloutdiv, 0, *this)
|
||||
, NAMED(coreclkcfg, r_coreclkcfg, 0, *this) {}
|
||||
|
||||
template <unsigned BUSWIDTH> inline void sysc::prci_regs::registerResources(sysc::tlm_target<BUSWIDTH> &target) {
|
||||
target.addResource(hfrosccfg, 0x0UL);
|
||||
target.addResource(hfxosccfg, 0x4UL);
|
||||
target.addResource(pllcfg, 0x8UL);
|
||||
target.addResource(plloutdiv, 0xcUL);
|
||||
target.addResource(coreclkcfg, 0x10UL);
|
||||
}
|
||||
|
||||
#endif // _PRCI_REGS_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 Sep 20 22:30:45 CEST 2017
|
||||
// Created on: Wed Oct 04 10:06:35 CEST 2017
|
||||
// * spi_regs.h Author: <RDL Generator>
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -44,7 +44,7 @@
|
||||
namespace sysc {
|
||||
|
||||
class spi_regs : public sc_core::sc_module, public sysc::resetable {
|
||||
protected:
|
||||
public:
|
||||
// storage declarations
|
||||
BEGIN_BF_DECL(sckdiv_t, uint32_t);
|
||||
BF_FIELD(div, 0, 12);
|
||||
@ -141,7 +141,6 @@ protected:
|
||||
sysc::sc_register<ie_t> ie;
|
||||
sysc::sc_register<ip_t> ip;
|
||||
|
||||
public:
|
||||
spi_regs(sc_core::sc_module_name nm);
|
||||
|
||||
template <unsigned BUSWIDTH = 32> void registerResources(sysc::tlm_target<BUSWIDTH> &target);
|
||||
|
@ -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 Sep 20 22:30:45 CEST 2017
|
||||
// Created on: Wed Oct 04 10:06:35 CEST 2017
|
||||
// * uart_regs.h Author: <RDL Generator>
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -44,7 +44,7 @@
|
||||
namespace sysc {
|
||||
|
||||
class uart_regs : public sc_core::sc_module, public sysc::resetable {
|
||||
protected:
|
||||
public:
|
||||
// storage declarations
|
||||
BEGIN_BF_DECL(txdata_t, uint32_t);
|
||||
BF_FIELD(data, 0, 8);
|
||||
@ -59,13 +59,11 @@ protected:
|
||||
BEGIN_BF_DECL(txctrl_t, uint32_t);
|
||||
BF_FIELD(txen, 0, 1);
|
||||
BF_FIELD(nstop, 1, 1);
|
||||
BF_FIELD(reserved, 2, 14);
|
||||
BF_FIELD(txcnt, 16, 3);
|
||||
END_BF_DECL() r_txctrl;
|
||||
|
||||
BEGIN_BF_DECL(rxctrl_t, uint32_t);
|
||||
BF_FIELD(rxen, 0, 1);
|
||||
BF_FIELD(reserved, 1, 15);
|
||||
BF_FIELD(rxcnt, 16, 3);
|
||||
END_BF_DECL() r_rxctrl;
|
||||
|
||||
@ -92,7 +90,6 @@ protected:
|
||||
sysc::sc_register<ip_t> ip;
|
||||
sysc::sc_register<div_t> div;
|
||||
|
||||
public:
|
||||
uart_regs(sc_core::sc_module_name nm);
|
||||
|
||||
template <unsigned BUSWIDTH = 32> void registerResources(sysc::tlm_target<BUSWIDTH> &target);
|
||||
|
@ -23,14 +23,19 @@
|
||||
#ifndef SIMPLESYSTEM_H_
|
||||
#define SIMPLESYSTEM_H_
|
||||
|
||||
#include "aon.h"
|
||||
#include "clint.h"
|
||||
#include "gpio.h"
|
||||
#include "plic.h"
|
||||
#include "prci.h"
|
||||
#include "spi.h"
|
||||
#include "uart.h"
|
||||
|
||||
#include <array>
|
||||
#include <sysc/kernel/sc_module.h>
|
||||
#include <sysc/memory.h>
|
||||
#include <sysc/router.h>
|
||||
#include <sysc/utilities.h>
|
||||
|
||||
#include "core_complex.h"
|
||||
|
||||
@ -40,14 +45,20 @@ class platform : public sc_core::sc_module {
|
||||
public:
|
||||
SC_HAS_PROCESS(platform);
|
||||
|
||||
SiFive::core_complex i_master;
|
||||
SiFive::core_complex i_core_complex;
|
||||
router<> i_router;
|
||||
uart i_uart;
|
||||
uart i_uart0, i_uart1;
|
||||
spi i_spi;
|
||||
gpio i_gpio;
|
||||
plic i_plic;
|
||||
aon i_aon;
|
||||
prci i_prci;
|
||||
clint i_clint;
|
||||
|
||||
memory<512_MB, 32> i_mem_qspi;
|
||||
memory<128_kB, 32> i_mem_ram;
|
||||
sc_core::sc_signal<sc_core::sc_time> s_clk;
|
||||
sc_core::sc_signal<bool> s_rst;
|
||||
sc_core::sc_signal<bool> s_rst, s_mtime_int, s_msie_int;
|
||||
|
||||
platform(sc_core::sc_module_name nm);
|
||||
|
||||
|
45
riscv.sc/incl/sysc/SiFive/prci.h
Normal file
45
riscv.sc/incl/sysc/SiFive/prci.h
Normal file
@ -0,0 +1,45 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2017 eyck@minres.com
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef _PRCI_H_
|
||||
#define _PRCI_H_
|
||||
|
||||
#include <sysc/tlm_target.h>
|
||||
|
||||
namespace sysc {
|
||||
|
||||
class prci_regs;
|
||||
|
||||
class prci : public sc_core::sc_module, public tlm_target<> {
|
||||
public:
|
||||
SC_HAS_PROCESS(prci);
|
||||
sc_core::sc_in<sc_core::sc_time> clk_i;
|
||||
sc_core::sc_in<bool> rst_i;
|
||||
prci(sc_core::sc_module_name nm);
|
||||
virtual ~prci() override; // need to keep it in source file because of fwd declaration of prci_regs
|
||||
|
||||
protected:
|
||||
void clock_cb();
|
||||
void reset_cb();
|
||||
void hfrosc_en_cb();
|
||||
sc_core::sc_time clk;
|
||||
std::unique_ptr<prci_regs> regs;
|
||||
sc_core::sc_event hfrosc_en_evt;
|
||||
};
|
||||
|
||||
} /* namespace sysc */
|
||||
|
||||
#endif /* _GPIO_H_ */
|
@ -34,8 +34,10 @@ public:
|
||||
protected:
|
||||
void clock_cb();
|
||||
void reset_cb();
|
||||
void transmit_data();
|
||||
sc_core::sc_time clk;
|
||||
std::unique_ptr<uart_regs> regs;
|
||||
std::vector<uint8_t> queue;
|
||||
};
|
||||
|
||||
} /* namespace sysc */
|
||||
|
Reference in New Issue
Block a user