[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gnucap-devel] two event queue questions
From: |
al davis |
Subject: |
Re: [Gnucap-devel] two event queue questions |
Date: |
Thu, 7 Jun 2012 13:00:35 -0400 |
User-agent: |
KMail/1.13.5 (Linux/2.6.32-5-amd64; KDE/4.4.5; x86_64; ; ) |
On Thursday 07 June 2012, Felix Salfelder wrote:
> verilog uses a discrete time (uint64_t), while gnucap runs
> with double (also 64 bit) time. unless time is really big,
> it's no problem to schedule all the events of a verilog
> device after converting to double. but then, i don't see why
> gnucap does use double for the master time.
Using a double was the obvious choice originally, years ago. In
a way, it still is but as you point out, sometimes an
alternative non-obvious choice may be a better choice.
Looking again, I could easily see defining a new type "TIME",
following gnucap's convention of class names being all caps.
This "TIME" needs to interface with double expressions like a
double but could have a different representation inside.
If you want to try it ...
Initially typedef TIME to be double. Keep this as a reference
for performance comparison.
Then, define a class TIME that initially is just a double, but
enforces strict type checking and adds a bit of overhead. You
will need to add all of the access functions and operations so
it can be used the same. Disable implicit conversions so you
will catch all of the places it is used. Benchmark again to
verify that you haven't messed it up.
Now, you can change the representation under the hood to try
alternative representations.