Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Verifying bit_vector help needed

Status
Not open for further replies.

teteu86

Newbie level 4
Joined
Sep 23, 2009
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,313
Verifying bit_vector

Hi. I have these ports:

up: buffer bit_vector(1 to 11);
floor: buffer integer range 1 to 11;

How can I verify if there is as least one element after up(floor) that is 1?

For example:
up<="00100000001"

If floor is 2, up(floor) = 0.
If floor is 3, up(floor) = 1.

If I'm on 5th, how can I write a code to verify if there is "1" as element since up(floor+1) until up(11)?
 

FvM

Super Moderator
Staff member
Joined
Jan 22, 2008
Messages
48,272
Helped
14,226
Reputation
28,713
Reaction score
12,919
Trophy points
1,393
Location
Bochum, Germany
Activity points
279,546
Verifying bit_vector

Code:
process(up,floor)
begin
variable check: std_logic;
check:='0';
for i in 1 to 11 loop
  if i>floor and up(i) = '1' then
    check:='1';
  end if;
end loop;
result<=check;
end process;
 

teteu86

Newbie level 4
Joined
Sep 23, 2009
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,313
Re: Verifying bit_vector

Thanks FvM.

I'm trying to write a code for a controller of elevator.

Until tonight, I'll post the results here.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top