EEVblog Electronics Community Forum
A Free & Open Forum For Electronics Enthusiasts & Professionals
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email
?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
This topic
This board
Entire forum
Google
Bing
Home
Help
Search
About us
Links
Login
Register
EEVblog Electronics Community Forum
»
Electronics
»
Microcontrollers
»
VHDL - How to test with IF only a subset of bits in a std_logic_vector
« previous
next »
Print
Search
Pages: [
1
]
Go Down
Author
Topic: VHDL - How to test with IF only a subset of bits in a std_logic_vector (Read 1912 times)
0 Members and 1 Guest are viewing this topic.
alank2
Super Contributor
Posts: 2185
VHDL - How to test with IF only a subset of bits in a std_logic_vector
«
on:
July 30, 2016, 07:11:04 pm »
I am trying:
signal recv_data : std_logic_vector(31 downto 0);
if (recv_data(7 downto 0) = "00000001") then
Fails - probably be specifying it wrong - can this be done?
Logged
AndyC_772
Super Contributor
Posts: 4228
Country:
Professional design engineer
Re: VHDL - How to test with IF only a subset of bits in a std_logic_vector
«
Reply #1 on:
July 30, 2016, 09:28:19 pm »
Yes, it can, and your syntax looks fine. Your problem is elsewhere.
Logged
CEL | Reliable Electronics
alank2
Super Contributor
Posts: 2185
Re: VHDL - How to test with IF only a subset of bits in a std_logic_vector
«
Reply #2 on:
July 30, 2016, 09:31:28 pm »
Are you sure?
I found the alias command that allowed me to do this and it does not error:
alias recv_data_7d0 is recv_data(7 downto 0);
Then this line does NOT error:
if (recv_data_7d0 = "00000001") then
Thanks!
Logged
AndyC_772
Super Contributor
Posts: 4228
Country:
Professional design engineer
Re: VHDL - How to test with IF only a subset of bits in a std_logic_vector
«
Reply #3 on:
July 30, 2016, 09:35:48 pm »
Yes, absolutely sure
What happens if you remove the extraneous brackets, ie.
Code:
[Select]
if recv_data(7 downto 0) = "00000001" then
Logged
CEL | Reliable Electronics
alank2
Super Contributor
Posts: 2185
Re: VHDL - How to test with IF only a subset of bits in a std_logic_vector
«
Reply #4 on:
July 30, 2016, 09:46:59 pm »
Now it is working! Wow, I am pretty sure I cut/paste that instruction in the first post directly from it. I must have had something else wrong.
Logged
Print
Search
Pages: [
1
]
Go Up
« previous
next »
Share me
Smf
EEVblog Electronics Community Forum
»
Electronics
»
Microcontrollers
»
VHDL - How to test with IF only a subset of bits in a std_logic_vector
There was an error while thanking
Thanking...
EEVblog Main Site
EEVblog on Youtube
EEVblog on Twitter
EEVblog on Facebook
EEVblog on Odysee