Konx
Guest
Fri Feb 12, 2010 11:33 am
Hello everyone.
I was searching in the group to check if someone have had the same
problem, and I've found this:
http://groups.google.it/group/comp.lang.verilog/browse_frm/thread/f230e591b38315f8#
Now, I understand that I can just assign the incoming "array [31:0]"
to "int a" without problem.
But in my case the input array is a 16-bit array.
Can I write inside my code something like:
input [15:0] window_size;
int a = window_size;
Could I have any problem, if I do in this way? or it is the "compiler"
that take care of filling the remaining 16 bit of the integer? (I'm
working on a 32-bit machine).
Thanks for help
Francesco.
gabor
Guest
Fri Feb 12, 2010 4:23 pm
On Feb 12, 4:33 am, Konx <cesco...@gmail.com> wrote:
Quote:
Hello everyone.
I was searching in the group to check if someone have had the same
problem, and I've found this:
http://groups.google.it/group/comp.lang.verilog/browse_frm/thread/f23...
Now, I understand that I can just assign the incoming "array [31:0]"
to "int a" without problem.
But in my case the input array is a 16-bit array.
Can I write inside my code something like:
input [15:0] window_size;
int a = window_size;
Could I have any problem, if I do in this way? or it is the "compiler"
that take care of filling the remaining 16 bit of the integer? (I'm
working on a 32-bit machine).
Thanks for help
Francesco.
The only problem I see is that an integer is signed and
an array is unsigned unless otherwise defined. So if you
needed to sign extend window_size this will not happen
as written, because as defined window_size is unsigned.
So in this case the integer would always be positive
(zero-extended).
Regards,
Gabor
Konx
Guest
Fri Feb 12, 2010 4:27 pm
On 12 Feb, 15:23, gabor <ga...@alacron.com> wrote:
Quote:
The only problem I see is that an integer is signed and
an array is unsigned unless otherwise defined. So if you
needed to sign extend window_size this will not happen
as written, because as defined window_size is unsigned.
So in this case the integer would always be positive
(zero-extended).
Thanks for both answers! In this particular case, I need only positive
numbers, so it is ok!
Thanks again
Francesco.