| Author |
Message |
anjo_ca
Joined: 08 Sep 2009 Posts: 4 Location: India
|
16 Oct 2009 8:01 bit width convertor |
|
|
|
|
i want to know how to convert 8 bit wide data to 32 bit wide one.actully i need a bit width convertor...can u plz help me giving some sugesstions.
with regards
Anjo CA
|
|
| Back to top |
|
 |
ckaa
Joined: 06 Apr 2006 Posts: 15 Helped: 4
|
16 Oct 2009 21:52 Re: bit width convertor |
|
|
|
|
Well if you want to do it in HDL then just define a 32 bit number and assign it to zero and 'OR' it with your 8 bit number. That should change it to a 32 bit number. If you want to do it in C or a high level language I believe a combination of "OR" and shift functions should do it, not sure though.
The above is only for unsigned numbers. If your number is signed then I believe you need to sign extend your number and not pad the upper bits with zeros. You'll get lots of info on this if you search for 'sign extension' on google. I hope this helps!
|
|
| Back to top |
|
 |
aslijia
Joined: 03 Nov 2006 Posts: 51 Helped: 1
|
19 Oct 2009 3:23 bit width convertor |
|
|
|
|
| if you just using a high level language (such C or SV), you can just assign 32'hM = 8'hM (M is the number), also M is a non-signed number
|
|
| Back to top |
|
 |
niravbhatt
Joined: 16 Mar 2009 Posts: 30 Helped: 2 Location: Ahmedabad,India
|
29 Oct 2009 5:49 Re: 8 bit to 32 bit data conversion |
|
|
|
|
I agree with the "ckaa". If you want to do it in HDL then just OR 8-bit number with 32 bit number.
It will work perfectly.
--
Nirav Bhatt
|
|
| Back to top |
|
 |
dcreddy1980
Joined: 03 Dec 2004 Posts: 189 Helped: 25 Location: Munich, Germany
|
31 Oct 2009 4:08 Re: 8 bit to 32 bit data conversion |
|
|
|
|
I dont agree with "ckaa" and "nirav bhat" for suggesting to use a OR gate.
Why do u want add gate count, unless synthesis tool removes this OR gate, there is no use of it.
If you really want to make 32 bit from 8-bit, you need to simply tie GND(i.e Logic-0) to top-24 bits and the remaining 8-bits of your o/p would be your i/p.
|
|
| Back to top |
|
 |
Google AdSense

|
31 Oct 2009 4:08 Ads |
|
|
|
|
|
|
| Back to top |
|
 |
bepobalote
Joined: 19 Mar 2005 Posts: 72 Helped: 11 Location: Europe
|
31 Oct 2009 22:02 Re: 8 bit to 32 bit data conversion |
|
|
|
|
| is your 8bit number signed or unsigned?
|
|
| Back to top |
|
 |