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.

VHDL command for: if (signal changes) then do something

Status
Not open for further replies.

tooh83

Newbie level 6
Joined
Feb 1, 2006
Messages
13
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Cairo , Egypt
Activity points
1,422
hi
i need to know if there is a command in vhdl which can do the following :
if (signal changes) then
do sth..
and if the answer is no then how can i do it ?
thnx in advance
 

vivek

Member level 4
Joined
May 19, 2005
Messages
69
Helped
10
Reputation
20
Reaction score
1
Trophy points
1,288
Activity points
2,040
signal event vhdl

you can use 'event like :

if (signal'event)
......

This will execute what u want whenever ur signal changes.
 

Iouri

Advanced Member level 2
Joined
Aug 17, 2005
Messages
682
Helped
87
Reputation
174
Reaction score
8
Trophy points
1,298
Activity points
4,814
what is event on a signal in vhdl

process (clk, reset)
begin
if reset = '0' then
prev_sig <= '0';
elsif (clk = '1' and clk'event) then
prev_sig <= current_sig;
end if;
process (clk)
if (clk = '1' and clk'event) then
if prev_sig /= current_sig then
<<< DO SOMETHING>>>
end if;
end if;
end process;
 

    tooh83

    Points: 2
    Helpful Answer Positive Rating

cmos babe

Full Member level 4
Joined
Jan 15, 2005
Messages
209
Helped
11
Reputation
22
Reaction score
0
Trophy points
1,296
Location
Dubai
Activity points
1,897
vhdl if signal changes

Process(signal)
begin
do something;
end process;
 

    tooh83

    Points: 2
    Helpful Answer Positive Rating

mwmah

Newbie level 3
Joined
Mar 11, 2006
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,302
Re: vhdl question

Foo: Process
Begin
Wait until signal'event;
...
End Process Foo;
 

salma ali bakr

Advanced Member level 3
Joined
Jan 27, 2006
Messages
971
Helped
104
Reputation
206
Reaction score
21
Trophy points
1,298
Activity points
7,491
Re: vhdl question

for a signal....u can use the "event" attribute to test if its value changes or not

signal'event
 

rishirameshkashyap

Newbie level 6
Joined
Nov 20, 2004
Messages
11
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,281
Activity points
144
Re: vhdl question

yes u can, go through this code . If any problem fee free to contact

library ieee;
use ieee.std_logic_1164.all;

entity flipflopT is
port( clk,t:in std_logic;
q,qq: out std_logic);
end flipflopT;

architecture arch of flipflopT is
signal tmp: std_logic;

begin
process(clk)
begin
if clk'event and (clk='1') and t='1' then tmp <=not tmp;
end if;
end process;
q<=tmp;
qq<=not tmp;
end arch;
 

master.ro

Member level 1
Joined
Apr 18, 2006
Messages
38
Helped
4
Reputation
8
Reaction score
0
Trophy points
1,286
Location
Romania
Activity points
1,523
Re: vhdl question

Why not use this?

process(signal)
begin
do st
end process;
 

    tooh83

    Points: 2
    Helpful Answer Positive Rating

koppolu1981

Junior Member level 3
Joined
Apr 20, 2006
Messages
29
Helped
2
Reputation
4
Reaction score
1
Trophy points
1,283
Activity points
1,529
Re: vhdl question

process is one construct tht can be used to solve ur problem.
The other way is u can use event for that which will be as follows.

ex: if the signal on which ur waiting is say "ret' then code looks as below

process(ret)
begin
////do something

end process

this results in a combinational logic
if event is used then that would also result in a sequential logic....
 

    tooh83

    Points: 2
    Helpful Answer Positive Rating

haseebcu

Member level 2
Joined
Feb 17, 2006
Messages
45
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,286
Activity points
1,639
Re: vhdl question

process(signal)
begin
do st
end process;
 

kangta

Junior Member level 2
Joined
Apr 4, 2006
Messages
20
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,281
Activity points
1,503
Re: vhdl question

tooh83 said:
hi
i need to know if there is a command in vhdl which can do the following :
if (signal changes) then
do sth..
and if the answer is no then how can i do it ?
thnx in advance

Of course !
u can try like this sequential statement :
IF (clk = '1' and clk'event ) THEN
zout <= '1';
ELSE
zout <= '0';
END IF;

but this code just be right if it is written in the PROCCESS statements .

let try !
 

emmos

Member level 2
Joined
Dec 30, 2003
Messages
48
Helped
3
Reputation
6
Reaction score
1
Trophy points
1,288
Activity points
472
Re: vhdl question

hi

there are 3 ways

1. a wait statement at the end or the beginning of the process

eg. wait on a

if 'a' changes then the process with re-evaluate

2. a sensitivity list in the process

eg. process (sensitivity list) --process (a)

3. and if statement with an event

good luck
 

eDance

Junior Member level 3
Joined
Dec 26, 2002
Messages
26
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
225
vhdl question

I prefer using rising_edge(sig) and falling_edge(sig) functions :)
 

rourabpaul

Member level 3
Joined
Aug 14, 2010
Messages
67
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Location
kolkata
Activity points
1,747
Re: vhdl question

i have signal name "NUM"(8 bit),
i want to start a state machine while NUM is changed,and this state machin is under a process(clk),
i have tried these
1> i wrote
if NUM'event then
---state machine start
=================
here the error is
line 97: unsupported Clock statement

2> i wrote
wait on NUM;
============
the error is
statement WAIT not allowed in a process with a sensitivity list

3>i include the NUM to process sensitivity list also

the error is
=============
Signal "name of the current state of my state machine" cannot be synthesized, bad synchronous description.
 

FvM

Super Moderator
Staff member
Joined
Jan 22, 2008
Messages
48,521
Helped
14,273
Reputation
28,809
Reaction score
12,977
Trophy points
1,393
Location
Bochum, Germany
Activity points
280,613
Re: vhdl question

You should try to get a more thorough understanding of the VHDL event concept. You can either have a synchronous (clock edge sensitive) or a combinational (state sensitive) process. In addition, an asynchronous condition can be combined with a clocked process, e.g. as a reset.

But you can't have additional events inside a clocked process. I notice, that your chasing the idea of additional events in a process since long. Apparently you didn't yet get through to the basic VHDL concepts behind.

In my view, there's no room for additional events in a clocked process, e.g. a state machine. If you want to detect a change in a particular input condition, you can compare the present signal state with the registered previous state and act according to the compare result.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top