EmbDev.net

Forum: FPGA, VHDL & Verilog How to check the value of a specific bit in vhdl


von NINA (Guest)


Rate this post
useful
not useful
hi , im trying to write a code and i need to check the first bit of a 
signle after that the second bit after that the third bit , on and on 
until i arrive to the bit num 10 , i just need to know if the bit is 1 
or 0 ,  how should i do it?

von Duke Scarring (Guest)


Rate this post
useful
not useful
NINA wrote:
> how should i do it?
with a comparison or a comparator

von Vancouver (Guest)


Rate this post
useful
not useful
NINA wrote:
> i need to check the first bit of a
> signle after that the second bit

First of all, make yourself more familar with the ideas behind VHDL. 
Checking a bit of a vector is absolutely basic.

if (signle[0]=='1')...
if (signle[1]=='1')...

von Lothar M. (Company: Titel) (lkmiller) (Moderator)


Rate this post
useful
not useful
NINA wrote:
> a signle
Whats that?

NINA wrote:
> until i arrive to the bit num 10
Starting from index 0 or from 1?

Show the (type-) definition of that vector of 10 or 11 bits.

von Dussel (Guest)


Rate this post
useful
not useful
Depending on what should be done, this could be a use case for a for 
loop:
1
for i in 0 to signle'high loop/generate
2
    if signle(i) = '1' then
3
        ...
4
    end if;
5
end loop/generate
I hope there is no syntax error, but the idea should be clear.

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.