simulavr
1.1.0
|
#include "config.h"
#include <vpi_user.h>
#include "avrdevice.h"
#include "avrfactory.h"
#include "rwmem.h"
#include "pin.h"
#include "avrerror.h"
#include "cmd/dumpargs.h"
#include "systemclock.h"
Go to the source code of this file.
Macros | |
#define | VPI_UNPACKS(name) |
#define | VPI_UNPACKI(name) |
#define | VPI_UNPACKT(name) |
#define | VPI_RETURN_INT(val) |
#define | AVR_HCHECK() |
#define | VPI_BEGIN() |
#define | VPI_END() vpi_free_object(argv); |
#define | VPI_REGISTER_TASK(name) |
#define | VPI_REGISTER_FUNC(name) |
Functions | |
static bool | checkHandle (int h) |
static PLI_INT32 | avr_create_tf (char *xx) |
static PLI_INT32 | avr_reset_tf (char *xx) |
static PLI_INT32 | avr_destroy_tf (char *xx) |
static PLI_INT32 | avr_tick_tf (char *xx) |
static PLI_INT32 | avr_set_time_tf (char *xx) |
static PLI_INT32 | avr_get_pin_tf (char *xx) |
static PLI_INT32 | avr_set_pin_tf (char *xx) |
static PLI_INT32 | avr_get_pc_tf (char *xx) |
static PLI_INT32 | avr_get_rw_tf (char *xx) |
static PLI_INT32 | avr_set_rw_tf (char *xx) |
static PLI_INT32 | avr_trace_tf (char *xx) |
static PLI_INT32 | avr_dump_arg_tf (char *xx) |
static PLI_INT32 | avr_dump_start_tf (char *xx) |
static PLI_INT32 | avr_dump_stop_tf (char *xx) |
static void | register_tasks () |
Variables | |
static std::vector< AvrDevice * > | devices |
void(* | vlog_startup_routines [])() |
#define AVR_HCHECK | ( | ) |
Definition at line 103 of file vpi.cpp.
Referenced by avr_destroy_tf(), avr_dump_arg_tf(), avr_get_pc_tf(), avr_get_pin_tf(), avr_get_rw_tf(), avr_reset_tf(), avr_set_pin_tf(), avr_set_rw_tf(), and avr_tick_tf().
#define VPI_BEGIN | ( | ) |
Definition at line 109 of file vpi.cpp.
Referenced by avr_create_tf(), avr_destroy_tf(), avr_dump_arg_tf(), avr_get_pc_tf(), avr_get_pin_tf(), avr_get_rw_tf(), avr_reset_tf(), avr_set_pin_tf(), avr_set_rw_tf(), avr_set_time_tf(), avr_tick_tf(), and avr_trace_tf().
#define VPI_END | ( | ) | vpi_free_object(argv); |
Definition at line 114 of file vpi.cpp.
Referenced by avr_create_tf(), avr_destroy_tf(), avr_dump_arg_tf(), avr_get_pc_tf(), avr_get_pin_tf(), avr_get_rw_tf(), avr_reset_tf(), avr_set_pin_tf(), avr_set_rw_tf(), avr_set_time_tf(), avr_tick_tf(), and avr_trace_tf().
#define VPI_REGISTER_FUNC | ( | name | ) |
Definition at line 129 of file vpi.cpp.
Referenced by register_tasks().
#define VPI_REGISTER_TASK | ( | name | ) |
Definition at line 117 of file vpi.cpp.
Referenced by register_tasks().
#define VPI_RETURN_INT | ( | val | ) |
Definition at line 97 of file vpi.cpp.
Referenced by avr_create_tf(), avr_get_pc_tf(), avr_get_pin_tf(), and avr_get_rw_tf().
#define VPI_UNPACKI | ( | name | ) |
Definition at line 71 of file vpi.cpp.
Referenced by avr_destroy_tf(), avr_dump_arg_tf(), avr_get_pc_tf(), avr_get_pin_tf(), avr_get_rw_tf(), avr_reset_tf(), avr_set_pin_tf(), avr_set_rw_tf(), and avr_tick_tf().
#define VPI_UNPACKS | ( | name | ) |
Definition at line 58 of file vpi.cpp.
Referenced by avr_create_tf(), avr_dump_arg_tf(), avr_get_pin_tf(), avr_set_pin_tf(), and avr_trace_tf().
#define VPI_UNPACKT | ( | name | ) |
Definition at line 84 of file vpi.cpp.
Referenced by avr_set_time_tf().
|
static |
This function creates a new AVR core and `returns' a handle to it Usage from Verilog:
$avr_create(device, progname) -> handle
where handle is an integer handle by which the avr can be accessed in all other calls here device is the name of the AVR device to create progname is the path to the flash program elf binary
Definition at line 153 of file vpi.cpp.
References AvrFactory::instance(), AvrDevice::Load(), AvrFactory::makeDevice(), VPI_BEGIN, VPI_END, VPI_RETURN_INT, and VPI_UNPACKS.
|
static |
This function destroys an existing AVR core. Usage from Verilog:
$avr_destroy(handle)
Definition at line 189 of file vpi.cpp.
References AVR_HCHECK, VPI_BEGIN, VPI_END, and VPI_UNPACKI.
|
static |
This allows to enable dumping of internal variables in the simulavrxx core as a Value Change Dump file. The arguments given to this function are exactly the same as when calling simulavrxx from the command line.
Definition at line 369 of file vpi.cpp.
References AVR_HCHECK, SetDumpTraceArgs(), VPI_BEGIN, VPI_END, VPI_UNPACKI, and VPI_UNPACKS.
|
static |
Initialize all dumpers and start them. Has to be done before any clock ticks on any AVR devices, if dumping is used!
Definition at line 383 of file vpi.cpp.
References DumpManager::Instance(), and DumpManager::start().
|
static |
Finishes all dumping processes at the end of the application.
Definition at line 389 of file vpi.cpp.
References DumpManager::Instance(), and DumpManager::stopApplication().
|
static |
This function reads the value of the program counter in the AVR. Usage from verilog: $avr_get_pc(handle) -> pc_value
Definition at line 284 of file vpi.cpp.
References AVR_HCHECK, VPI_BEGIN, VPI_END, VPI_RETURN_INT, and VPI_UNPACKI.
|
static |
This function reads an AVR pin value. Usage from verilog: $avr_pin_get(handle, name) -> value
Definition at line 241 of file vpi.cpp.
References AVR_HCHECK, Pin::outState, VPI_BEGIN, VPI_END, VPI_RETURN_INT, VPI_UNPACKI, and VPI_UNPACKS.
|
static |
This function reads the value of a RAM-readable location in the AVR (0..31 are the regs, followed by the IO-space etc). Usage from verilog: $avr_get_rw(handle, adr) -> val where adr is the adress to read and val is the returned value at that address
Definition at line 303 of file vpi.cpp.
References AVR_HCHECK, VPI_BEGIN, VPI_END, VPI_RETURN_INT, and VPI_UNPACKI.
|
static |
This function resets an existing AVR core. Usage from Verilog:
$avr_reset(handle)
Definition at line 173 of file vpi.cpp.
References AVR_HCHECK, VPI_BEGIN, VPI_END, and VPI_UNPACKI.
|
static |
This function sets an AVR pin value. Usage from verilog: $avr_pin_set(handle, name, val)
Definition at line 260 of file vpi.cpp.
References AVR_HCHECK, Pin::SetInState(), VPI_BEGIN, VPI_END, VPI_UNPACKI, and VPI_UNPACKS.
|
static |
Counterpart to avr_get_rw_tf. It sets the value of a RAM-readable location in the AVR (0..31 are the regs, followed by the IO-space etc). Usage from verilog: $avr_set_rw(handle, adr, val) where adr is the adress to read and val is the value to set at that address
Definition at line 323 of file vpi.cpp.
References AVR_HCHECK, VPI_BEGIN, VPI_END, and VPI_UNPACKI.
|
static |
Set the time in the AVR system, in ns. Used for trace dumps etc. $avr_time(handle)
Definition at line 224 of file vpi.cpp.
References SystemClock::Instance(), SystemClock::SetCurrentTime(), VPI_BEGIN, VPI_END, and VPI_UNPACKT.
|
static |
This function ticks the clock of an AVR. Usage from Verilog:
$avr_tick(handle)
Definition at line 209 of file vpi.cpp.
References AVR_HCHECK, VPI_BEGIN, VPI_END, and VPI_UNPACKI.
|
static |
Enable or disable tracing for all AVR core. TODO: Implement tracing per core?
Usage from Verilog:
$avr_trace(tracename)
where tracename is the output file name for tracing. If it is the empty string, tracing will be disabled again and the file will be closed.
Definition at line 349 of file vpi.cpp.
References SystemConsoleHandler::SetTraceFile(), SystemConsoleHandler::StopTrace(), sysConHandler, VPI_BEGIN, VPI_END, and VPI_UNPACKS.
|
static |
Definition at line 394 of file vpi.cpp.
References VPI_REGISTER_FUNC, and VPI_REGISTER_TASK.
|
static |
Definition at line 41 of file vpi.cpp.
Referenced by DumpManager::all(), DumpManager::detachAvrDevices(), DumpManager::registerAvrDevice(), DumpManager::save(), DumpManager::seekValueByName(), DumpManager::SetSingleDeviceApp(), and DumpManager::unregisterAvrDevice().
void(* vlog_startup_routines[])() |