Line 1... |
Line 1... |
/**
|
/*
|
* @file
|
* Copyright 2018 Sergey Khabarov, sergeykhbr@gmail.com
|
* @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
|
*
|
* @author Sergey Khabarov - sergeykhbr@gmail.com
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
* @brief CPU synthesizable SystemC class declaration.
|
* 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.
|
*/
|
*/
|
|
|
#include "api_core.h"
|
#include "api_core.h"
|
#include "cpu_riscv_rtl.h"
|
#include "cpu_riscv_rtl.h"
|
|
|
Line 36... |
Line 45... |
deleteSystemC();
|
deleteSystemC();
|
RISCV_event_close(&config_done_);
|
RISCV_event_close(&config_done_);
|
}
|
}
|
|
|
void CpuRiscV_RTL::postinitService() {
|
void CpuRiscV_RTL::postinitService() {
|
ibus_ = static_cast<IBus *>(
|
ibus_ = static_cast<IMemoryOperation *>(
|
RISCV_get_service_iface(bus_.to_string(), IFACE_BUS));
|
RISCV_get_service_iface(bus_.to_string(), IFACE_MEMORY_OPERATION));
|
|
|
if (!ibus_) {
|
if (!ibus_) {
|
RISCV_error("Bus interface '%s' not found",
|
RISCV_error("Bus interface '%s' not found",
|
bus_.to_string());
|
bus_.to_string());
|
return;
|
return;
|
Line 77... |
Line 86... |
void CpuRiscV_RTL::createSystemC() {
|
void CpuRiscV_RTL::createSystemC() {
|
sc_set_default_time_unit(1, SC_NS);
|
sc_set_default_time_unit(1, SC_NS);
|
|
|
/** Create all objects, then initilize SystemC context: */
|
/** Create all objects, then initilize SystemC context: */
|
wrapper_ = new RtlWrapper(static_cast<IService *>(this), "wrapper");
|
wrapper_ = new RtlWrapper(static_cast<IService *>(this), "wrapper");
|
|
registerInterface(static_cast<ICpuGeneric *>(wrapper_));
|
registerInterface(static_cast<ICpuRiscV *>(wrapper_));
|
registerInterface(static_cast<ICpuRiscV *>(wrapper_));
|
|
registerInterface(static_cast<IResetListener *>(wrapper_));
|
w_clk = wrapper_->o_clk;
|
w_clk = wrapper_->o_clk;
|
wrapper_->o_nrst(w_nrst);
|
wrapper_->o_nrst(w_nrst);
|
wrapper_->i_time(wb_time);
|
wrapper_->i_time(wb_time);
|
wrapper_->o_req_mem_ready(w_req_mem_ready);
|
wrapper_->o_req_mem_ready(w_req_mem_ready);
|
wrapper_->i_req_mem_valid(w_req_mem_valid);
|
wrapper_->i_req_mem_valid(w_req_mem_valid);
|