|
From: Cary R. <cy...@ya...> - 2014-12-08 23:23:14
|
I personally don't think I'm missing anything, but please correct me if I'm wrong.
In Verilog we need the ability to pass calculated values of a given type and for some special system tasks we need to instead pass expressions that will be evaluated later (e.g. $strobe, $monitor, etc.). I believe the stacks need to be enhanced to support not only constant values like they do now, but also have the ability to handle expressions that are type correct. Maybe all they really need to support are expressions. For example: $strobe(a+1); should push an expression (pointer?) a+1 onto the vec4 stack that when used is evaluated and the calculated value is returned. As a start we could add this for simple variable references and once that was working we could add a few of the common cases that were lost when converting to the stack system.
Since we cannot know which system tasks need this we probably should just pass expressions (anonymous functions) to every system task. I believe we could assume system function are run in zero time, but for consistency we could also treat them like tasks.
It's also likely more complicated than what's described above since we need to pop the expression off the stack and attach it to system task and then when the argument is processed we need to calculate the value. For $strobe this is not too bad since it is only run once at a specific time, though you may want to cache the calculated value in case the task implementation gets the value multiple times. For $monitor this is significantly more complicated since we need to be sensitive to expression changes and evaluate the expression each time one of them changes. My assumption is that the evaluation code will be the same for both cases, but for monitor we need to have the ability to say I am sensitive to any changes in this expression. The sensitivity code could traverse the expression(s) looking for variables to add to the sensitivity list or the compiler could create a sensitivity list for the anonymous function. I'm not sure how all this fits into the standard VPI interface. From an execution standpoint I see this as an anonymous zero argument function so all you need on the stack is a function pointer.
Okay that's more than enough for now.
Cary
On Monday, December 8, 2014 2:10 PM, Stephen Williams <st...@ic...> wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 12/08/2014 01:28 PM, Cary R. wrote:
> I'm slightly concerned how we are going to get complex expression
> to work with the stack based calls. I think we may need to extend
> the stacks we have to also allow them to support expressions that
> return the given type (e.g. push 4'b1000 or push an expression that
> returns a 4 bit value to the vec4 stack). The expression would need
> to be evaluated when it was popped to generate the value that is
> actually returned by the pop.
I think you are missing that the stack based system is a well-
traveled path, blazed by things like Forth, and HP calculators.
Arbitrarily complex expressions are possible, unless I'm missing
something in your point.
> I need to look at the stack stuff in more detail before I make any
> other comments, but it seems like there could also be issues with
> deferred tasks that do not have a specific order of evaluation
> (e.g. multiple $strobe and/or $monitor calls in the same module
> (stack scope).
The issues that plague the vec4-stack version would be the same
that get in the way with the pre-stack version. In particular,
if $strobe were to try to access a value in the vec4 stack, the
problem is more obvious, but the same problem would come up in
the pre-stack implementation. You might be lucky enough to get
away with it in the pre-stack version, instead of making an obvious
mess post-stack.
- --
Steve Williams "The woods are lovely, dark and deep.
steve at icarus.com But I have promises to keep,
http://www.icarus.com and lines to code before I sleep,
http://www.picturel.com And lines to code before I sleep."
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iEYEARECAAYFAlSGIaEACgkQrPt1Sc2b3inkhQCgwz/oY7l7WI7PKxnp9lij1fzg
9zYAnRiv2bhbiXZ4/msxYfIhvJRjzvcZ
=wK6I
-----END PGP SIGNATURE-----
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
Iverilog-devel mailing list
Ive...@li...
https://lists.sourceforge.net/lists/listinfo/iverilog-devel
|