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. (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.

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [vhdl]VHDL code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig