Hi everybody !
It's nice to see some activity here
To Tricky and Eilert :
Yes of course I know numeric_std (signed and unsigned) enough
to see what it is good for and to know it does not address my need.
Currently I'm not looking at synthesisable code
but behavioural description. I want to avoid SystemC
and similar oddities, why would I need them when I have GHDL ?
And when the behaviour is right, i translate to std_ulogic.
CRAY screwed with floating point, but despite the high costs,
it sold well. Hint : it was FAST. Yet I know the reluctantly accepted IEEE758,
the same way they accepted 2-s complement after the CDC line which was 1s complement.
I don't want to screw with arithmetics or standards.
I just see that I spend too much time coding and simulating individual
bits when the simulator's CPU can do a much simpler and faster work.
I'll sort all the initialisation and other usual issues of my models later
(during the transition to std_ulogic)
but i don't think there will be much to care about because i use to code
defensivly and forward-looking.
I'm not doing mathematics, i'm doing digital electronics and I look at what
does the job fastest
Don't worry : std_ulogic is not going to be thrown away,
or else, how will i synthesise my code ?
yes, so what ?
data is data.
i agree.
On the other side, how many times did you see in VHDL "x / 2**y "
that makes a stupid bit shift using a divide (slow) and an exponential ? (super slow) ?
haha
more precisely : designers who know HW and SW well.
I often hear the argument : "don't do X because it is potentially dangerous".
Fine, I know the dangers and I take appropriate precautions. C integers are a bitch
but I know them for a while now so I can code defensively and efficiently.
But that is the problem. Who says an integer is implemented as a 2's
complement binary signal array?
it's a convenient compromise, it is adopted by ... all the new computer
architectures since the 1980's that i know. Now if you prefer 1's complement,
it's not my problem
So MyHDL assumes a specific implementation of integers in the
hardware?
If the OP wants to treat integers as an array of a binary data type,
then he needs to write the functions to do that.
He will either need
to convert the integers to an array of binary values and perform the
logic operation on those, or he can use looping constructs to isolate
the individual bits of the integer and operate on those.
There are 3 ways :
- as you wrote : plain slow (use of std_ulogic is faster)
- modify the compiler : that's a long-term goal
- VHPIDIRECT : what i'll do first
it only works with GHDL (maybe Aldec) but it's easy and fast to write
and it's a first step to defining the behaviour of the boolean extension
before the compiler is modified.
The problem is not that it can't be done, the OP simply doesn't know
how to write a function to do this.
Rick, I thought you knew me better :-/
He is thinking at a very simple
level expecting there to be logic operators on integers for him to
use. He needs to consider how logic operators could be implemented on
integers.
give me 48h (well 2h are enough) and i'll show you a few tricks
Did I say that I have added a graphic framebuffer interface to GHDL,
or I wrote code that reads the computer's environment variables ?
OK it's only for GHDL but it works great and once you understand
the guts, it's easy
Talk to you all soon,
yg