forked from steveicarus/iverilog
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from steveicarus/master
Code changes from steveicarus/iverilog
- Loading branch information
Showing
7 changed files
with
69 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright (c) 2000-2016 Stephen Williams ([email protected]) | ||
* Copyright (c) 2000-2017 Stephen Williams ([email protected]) | ||
* Copyright (c) 2016 CERN Michele Castellana ([email protected]) | ||
* | ||
* This source code is free software; you can redistribute it | ||
|
@@ -304,16 +304,16 @@ bool NetScope::auto_name(const char*prefix, char pad, const char* suffix) | |
*/ | ||
bool NetScope::replace_parameter(perm_string key, PExpr*val, NetScope*scope) | ||
{ | ||
bool flag = false; | ||
if (parameters.find(key) == parameters.end()) | ||
return false; | ||
|
||
if (parameters.find(key) != parameters.end()) { | ||
param_expr_t&ref = parameters[key]; | ||
ref.val_expr = val; | ||
ref.val_scope = scope; | ||
flag = true; | ||
} | ||
param_expr_t&ref = parameters[key]; | ||
if (ref.local_flag) | ||
return false; | ||
|
||
return flag; | ||
ref.val_expr = val; | ||
ref.val_scope = scope; | ||
return true; | ||
} | ||
|
||
bool NetScope::make_parameter_unannotatable(perm_string key) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright (c) 2002-2012 Stephen Williams ([email protected]) | ||
* Copyright (c) 2002-2017 Stephen Williams ([email protected]) | ||
* | ||
* This source code is free software; you can redistribute it | ||
* and/or modify it in source code form under the terms of the GNU | ||
|
@@ -63,6 +63,16 @@ char* __vpiNamedEvent::vpi_get_str(int code) | |
return generic_get_str(code, scope_, name_, NULL); | ||
} | ||
|
||
vpiHandle __vpiNamedEvent::vpi_put_value(p_vpi_value, int) | ||
{ | ||
// p_vpi_value may be NULL, and an event doesn't care | ||
// what the value is | ||
vvp_vector4_t val; | ||
vvp_net_ptr_t dest(funct, 0); | ||
vvp_send_vec4(dest, val, vthread_get_wt_context()); | ||
|
||
return this; | ||
} | ||
|
||
vpiHandle __vpiNamedEvent::vpi_handle(int code) | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright (c) 2008-2016 Stephen Williams ([email protected]) | ||
* Copyright (c) 2008-2017 Stephen Williams ([email protected]) | ||
* | ||
* This source code is free software; you can redistribute it | ||
* and/or modify it in source code form under the terms of the GNU | ||
|
@@ -464,6 +464,7 @@ int vpip_time_units_from_handle(vpiHandle obj) | |
struct __vpiSysTaskCall*task; | ||
__vpiScope*scope; | ||
struct __vpiSignal*signal; | ||
__vpiNamedEvent*event; | ||
|
||
if (obj == 0) | ||
return vpip_get_time_precision(); | ||
|
@@ -483,6 +484,11 @@ int vpip_time_units_from_handle(vpiHandle obj) | |
scope = vpip_scope(signal); | ||
return scope->time_units; | ||
|
||
case vpiNamedEvent: | ||
event = dynamic_cast<__vpiNamedEvent*>(obj); | ||
scope = event->get_scope(); | ||
return scope->time_units; | ||
|
||
default: | ||
fprintf(stderr, "ERROR: vpip_time_units_from_handle called with " | ||
"object handle type=%u\n", obj->get_type_code()); | ||
|
@@ -1104,7 +1110,13 @@ vpiHandle vpi_put_value(vpiHandle obj, s_vpi_value*vp, | |
|
||
vpip_put_value_event*put = new vpip_put_value_event; | ||
put->handle = obj; | ||
put->value = *vp; | ||
if (dynamic_cast<__vpiNamedEvent*>(obj)) { | ||
put->value.format = vpiIntVal; | ||
put->value.value.integer = 0; | ||
} else { | ||
assert(vp); | ||
put->value = *vp; | ||
} | ||
/* Since this is a scheduled put event we must copy any pointer | ||
* data to keep it available until the event is actually run. */ | ||
switch (put->value.format) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
#ifndef IVL_vpi_priv_H | ||
#define IVL_vpi_priv_H | ||
/* | ||
* Copyright (c) 2001-2015 Stephen Williams ([email protected]) | ||
* Copyright (c) 2001-2017 Stephen Williams ([email protected]) | ||
* Copyright (c) 2016 CERN Michele Castellana ([email protected]) | ||
* | ||
* This source code is free software; you can redistribute it | ||
|
@@ -479,8 +479,10 @@ class __vpiNamedEvent : public __vpiHandle { | |
__vpiNamedEvent(__vpiScope*scope, const char*name); | ||
~__vpiNamedEvent(); | ||
int get_type_code(void) const; | ||
__vpiScope*get_scope(void) const { return scope_; } | ||
int vpi_get(int code); | ||
char* vpi_get_str(int code); | ||
vpiHandle vpi_put_value(p_vpi_value val, int flags); | ||
vpiHandle vpi_handle(int code); | ||
|
||
inline void add_vpi_callback(__vpiCallback*cb) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters