assert question

B

Benjamin Couillard

Hi everyone,

I was wondering if I can do the following in VHDL :

my_process : process(CLK)
begin
if rising_edge(CLK) then
if (load_reg = '1') then
assert unsigned(DATA) > 10
report "error, DATA must be greater than 10"
severity error;
end if;
end if;
end process;

I've tried the following code in Active-HDL, and no assertions were
triggered in simulation even though there should have. Is it supposed
to trigger? Is there another way to write that assertion?

Best regards
 
T

Tricky

Hi everyone,

I was wondering if I can do the following in VHDL :

my_process : process(CLK)
begin
   if rising_edge(CLK) then
     if (load_reg = '1') then
            assert unsigned(DATA) > 10
            report "error, DATA must be greater than 10"
            severity error;
     end if;
   end if;
end process;

I've tried the following code in Active-HDL, and no assertions were
triggered in simulation even though there should have. Is it supposed
to trigger? Is there another way to write that assertion?

Best regards

Theres nothing wrong with the code. I can only assume that DATA is
greater than 10 whenever the process triggers. Or load_reg = '0'.
 
B

Benjamin Couillard

Theres nothing wrong with the code. I can only assume that DATA is
greater than 10 whenever the process triggers. Or load_reg = '0'.

Ok, I found out what the problem was. I was using variables instead of
signals in the assert statement (I simplified my statement a bit to
make it easier to understand) and I didn't realize that it would solve
the problem.
 
D

Don Otknow

Ok, I found out what the problem was. I was using variables instead of
signals in the assert statement (I simplified my statement a bit to
make it easier to understand) and I didn't realize that it would solve
the problem.

I thought variables can only be declared in processes and thus their
scope
only extends to the process they're declared in? So then by your
example
my_process should not have been able to see DATA or load_reg,
whichever was
declared as a variable. Could you post the non-simplified code? I'm
curious.
 
T

Tricky

I thought variables can only be declared in processes and thus their
scope
only extends to the process they're declared in? So then by your
example
my_process should not have been able to see DATA or load_reg,
whichever was
declared as a variable. Could you post the non-simplified code? I'm
curious.

shared variabled can be placed inside architectures and read by all
processes.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,521
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top