Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > assert statement

Reply
Thread Tools

assert statement

 
 
Ashani Patel
Guest
Posts: n/a
 
      07-01-2008
can anyone tell me what's wrong with this assert statements.

hereis my code:

----------------------------------------------------------------------------------
-- Company:
-- Engineer:
--
-- Create Date: 17:54:42 05/12/2008
-- Design Name:
-- Module Name: fifoashani - Behavioral
-- Project Name:
-- Target Devices:
-- Tool versions:
-- Description:
--
-- Dependencies:
--
-- Revision:
-- Revision 0.01 - File Created
-- Additional Comments:
--
----------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;

---- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;

entity fifo is
port( wren : in std_logic;
rden: in std_logic;
reset : in std_logic;
clk : in std_logic;
data : in std_logic_vector(3 downto 0);
stackfull: out std_logic;
stackempty: out std_logic;
dop: out std_logic_vector(3 downto 0));
end fifo;

architecture Behavioral of fifo is

type stack is array(0 to 7) of std_logic_vector(3 downto 0);
signal int_reg : std_logic_vector(3 downto 0);
signal int_stack : stack;
signal countup: integer :=0;
signal countdn: integer :=0;
signal stackempty_var: std_logic :='0';
signal stackfull_var : std_logic :='0';



begin

process(clk)


begin


if(clk'event and clk='1') then

if (reset = '1') then
stackfull_var <= '0';
stackempty_var <= '0';
countup <= 0;
countdn <= 0;
int_reg <= "0000";


elsif(wren = '1') then
assert not (countup>7)
report " stackfull"
severity NOTE ;

-- if(countup>7) then
-- stackfull_var <='1';

int_stack(countup)<= data;
countup <= countup + 1;


elsif(rden = '1') then
assert (countdn >7)
report "stack empty"
severity NOTE ;
-- if(countdn > 7) then
-- stackempty_var <= '1';

int_reg <= int_stack(countdn);
countdn <= countdn + 1;
end if;

end if;

end process;

dop <= int_reg;
stackfull <= stackfull_var;
stackempty <= stackempty_var;

end Behavioral;

 
Reply With Quote
 
 
 
 
Hauke D
Guest
Posts: n/a
 
      07-01-2008
Hi,


On Jul 1, 9:39 am, Ashani Patel <(E-Mail Removed)> wrote:
> can anyone tell me what's wrong with this assert statements.
>
> hereis my code:
> <snip>


It would be much more helpful to know what problem you're having. Are
you getting error messages, and if so, what are they? Is your code not
behaving as expected, and if so, what is the expected behavior and
what behavior are you getting?

Regards,
-- Hauke D
 
Reply With Quote
 
 
 
 
frosty
Guest
Posts: n/a
 
      07-01-2008
If I'm not completely wrong you are using the assert statement in a
false manner. A assert-statement checks the condition and if the
condition is not fullfilled it sets the report.
Your conditions for full(empty) are not met until countup(countdn)
reaches the value 7. So, for the first 7 values the note is printed.

regards,
Matthias
 
Reply With Quote
 
Tricky
Guest
Posts: n/a
 
      07-02-2008
On 1 Jul, 11:19, frosty <(E-Mail Removed)> wrote:
> If I'm not completely wrong you are using the assert statement in a
> false manner. A assert-statement checks the condition and if the
> condition is not fullfilled it sets the report.
> Your conditions for full(empty) are not met until countup(countdn)
> reaches the value 7. So, for the first 7 values the note is printed.
>
> regards,
> *Matthias


Personally, I find code a lot more readable if asserts are completly
ignored and this is used instead:

if problem then report "there is a problem" severity WARNING;

The assert does mean when your are reading that a test is being
performed, and tells the synthesiser to ignore it, but the report
should do that for you anyway.
 
Reply With Quote
 
KJ
Guest
Posts: n/a
 
      07-02-2008
On Jul 2, 10:48*am, Tricky <(E-Mail Removed)> wrote:

> Personally, I find code a lot more readable if asserts are completly
> ignored and this is used instead:
>
> if problem then report "there is a problem" severity WARNING;
>


Dang that "end if;" anyway...
Dang, can't use that as a concurrent statement either...

But your point is a good one, getting over the learning curve hump
that the assert condition is asserting something to be true, but the
message you display is what you display when the condition fails can
be frustrating...until you get over that hump.

KJ
 
Reply With Quote
 
Mike Treseler
Guest
Posts: n/a
 
      07-03-2008
Tricky wrote:

> Personally, I find code a lot more readable if asserts are completly
> ignored and this is used instead:
>
> if problem then report "there is a problem" severity WARNING;



The problem I have with asserts is not with the polarity,
but with debugging.

I wrote a function that defaults as a print to stdio
with optional parameters for comments, expected value, and mode.
On the first cut, I just print. Later I add an expected value
and print differences and error messages for failures.
Passes can be quiet or verbose.

-- Mike Treseler
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
To assert or not to assert... ImpalerCore C Programming 79 05-17-2010 12:47 PM
Showing value of loop iteration in assert statement dwerdna VHDL 5 03-31-2005 05:23 PM
assert 0, "foo" vs. assert(0, "foo") Thomas Guettler Python 3 02-23-2005 07:53 PM
assert(x) and '#define ASSERT(x) assert(x)' Alex Vinokur C Programming 5 11-25-2004 08:48 PM
RE: remove assert statement (Was: Re: PEP new assert idiom) Robert Brewer Python 1 11-07-2004 06:53 PM



Advertisments