Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > Does the last elseif run or not?

Reply
Thread Tools

Does the last elseif run or not?

 
 
fl
Guest
Posts: n/a
 
      02-24-2013
Hi,
I have the testbench generated by Matlab HDL coder below the dot line.
Signal "filter_out_rdenb" is connected to a filter CE_OUT component pin (This filter is the DUT of this testbench).


I am curious about line ld. It has the condition line la:

filter_out_rdenb='1';

then line lb through le will has condition: "filter_out_rdenb='0'". Is this right?

But it again check
lc: ELSIF filter_out_rdenb = '1'
at line lc.

I think ld will never be run. Does Matlab HDL Coder wrong?
Or this is intentional to test an abnormal filter CE_OUT condition? I cannot imagine it now. Could you tell me that if that is right?


Thanks

...............
checker_1: PROCESS(clk, reset)
BEGIN
IF reset = '1' THEN
filter_out_timeout <= 0;
filter_out_errCnt <= 0;
filter_out_testFailure <= '0';
ELSIF clk'event and clk ='1' THEN
la: IF filter_out_rdenb = '1' THEN
filter_out_timeout <= 0;
IF filter_out /= filter_out_expected THEN
filter_out_errCnt <= filter_out_errCnt + 1;
filter_out_testFailure <= '1';
ASSERT FALSE
REPORT "Error in filter_out: Expected "
& to_hex(filter_out_expected)
& " Actual "
& to_hex(filter_out)
SEVERITY ERROR;
IF filter_out_errCnt >= MAX_ERROR_COUNT THEN
ASSERT FALSE
REPORT "Number of errors have exceeded the maximum error"
SEVERITY Warning;
END IF;
END IF;
lb: ELSIF filter_out_timeout > MAX_TIMEOUT AND filter_out_rdenb = '1' THEN
filter_out_errCnt <= filter_out_errCnt + 1;
filter_out_testFailure <= '1';
ASSERT FALSE
REPORT "Timeout: Data was not received after timeout."
SEVERITY FAILURE ;
lc: ELSIF filter_out_rdenb = '1' THEN
ld: filter_out_timeout <= filter_out_timeout + 1 ;
le: END IF;
END IF;
END PROCESS checker_1;
 
Reply With Quote
 
 
 
 
Nicolas Matringe
Guest
Posts: n/a
 
      02-24-2013
Hello

Le 24/02/2013 20:39, fl a écrit :
> Hi,
> I have the testbench generated by Matlab HDL coder below the dot line.
> Signal "filter_out_rdenb" is connected to a filter CE_OUT component pin (This filter is the DUT of this testbench).
>
> I am curious about line ld. It has the condition line la:
> filter_out_rdenb='1';
>
> then line lb through le will has condition: "filter_out_rdenb='0'". Is this right?
>
> But it again check
> lc: ELSIF filter_out_rdenb = '1'
> at line lc.
>
> I think ld will never be run. Does Matlab HDL Coder wrong?
> Or this is intentional to test an abnormal filter CE_OUT condition? I cannot imagine it now. Could you tell me that if that is right?
>
>
> Thanks
>
> ..............
> checker_1: PROCESS(clk, reset)
> BEGIN
> IF reset = '1' THEN

[...]
> ELSIF clk'event and clk ='1' THEN
> la: IF filter_out_rdenb = '1' THEN

[...]
> lb: ELSIF filter_out_timeout > MAX_TIMEOUT AND filter_out_rdenb = '1' THEN

[...]
> lc: ELSIF filter_out_rdenb = '1' THEN
> ld: filter_out_timeout <= filter_out_timeout + 1 ;
> le: END IF;
> END IF;
> END PROCESS checker_1;


This makes no sense, every condition tests for filter_out_rdenb = '1'.
Conditions lb and lc will always be false or overriden by la.

I've never trusted automatic code generation and this is not going to
make me change my mind...

Nicolas

 
Reply With Quote
 
 
 
 
rickman
Guest
Posts: n/a
 
      02-24-2013
On 2/24/2013 2:39 PM, fl wrote:
> Hi,
> I have the testbench generated by Matlab HDL coder below the dot line.
> Signal "filter_out_rdenb" is connected to a filter CE_OUT component pin (This filter is the DUT of this testbench).
>
>
> I am curious about line ld. It has the condition line la:
>
> filter_out_rdenb='1';
>
> then line lb through le will has condition: "filter_out_rdenb='0'". Is this right?
>
> But it again check
> lc: ELSIF filter_out_rdenb = '1'
> at line lc.
>
> I think ld will never be run. Does Matlab HDL Coder wrong?
> Or this is intentional to test an abnormal filter CE_OUT condition? I cannot imagine it now. Could you tell me that if that is right?


Not only will the section under 1c not run, the condition at 1b will
never evaluate as true and so that section can never run either. Unless
there is something I'm missing that would make the structure different
from the indentation this code is rather bogus. How was the code
generated? What are the inputs?

I would report it to MatLab.

Rick


> ..............
> checker_1: PROCESS(clk, reset)
> BEGIN
> IF reset = '1' THEN
> filter_out_timeout<= 0;
> filter_out_errCnt<= 0;
> filter_out_testFailure<= '0';
> ELSIF clk'event and clk ='1' THEN
> la: IF filter_out_rdenb = '1' THEN
> filter_out_timeout<= 0;
> IF filter_out /= filter_out_expected THEN
> filter_out_errCnt<= filter_out_errCnt + 1;
> filter_out_testFailure<= '1';
> ASSERT FALSE
> REPORT "Error in filter_out: Expected "
> & to_hex(filter_out_expected)
> & " Actual"
> & to_hex(filter_out)
> SEVERITY ERROR;
> IF filter_out_errCnt>= MAX_ERROR_COUNT THEN
> ASSERT FALSE
> REPORT "Number of errors have exceeded the maximum error"
> SEVERITY Warning;
> END IF;
> END IF;
> lb: ELSIF filter_out_timeout> MAX_TIMEOUT AND filter_out_rdenb = '1' THEN
> filter_out_errCnt<= filter_out_errCnt + 1;
> filter_out_testFailure<= '1';
> ASSERT FALSE
> REPORT "Timeout: Data was not received after timeout."
> SEVERITY FAILURE ;
> lc: ELSIF filter_out_rdenb = '1' THEN
> ld: filter_out_timeout<= filter_out_timeout + 1 ;
> le: END IF;
> END IF;
> END PROCESS checker_1;



--

Rick
 
Reply With Quote
 
fl
Guest
Posts: n/a
 
      02-24-2013
On Sunday, February 24, 2013 4:49:58 PM UTC-5, rickman wrote:
> On 2/24/2013 2:39 PM, fl wrote:
>
> > Hi,

>
> > I have the testbench generated by Matlab HDL coder below the dot line.

>
> > Signal "filter_out_rdenb" is connected to a filter CE_OUT component pin(This filter is the DUT of this testbench).

>
> >

>
> >

>
> > I am curious about line ld. It has the condition line la:

>
> >

>
> > filter_out_rdenb='1';

>
> >

>
> > then line lb through le will has condition: "filter_out_rdenb='0'". Is this right?

>
> >

>
> > But it again check

>
> > lc: ELSIF filter_out_rdenb = '1'

>
> > at line lc.

>
> >

>
> > I think ld will never be run. Does Matlab HDL Coder wrong?

>
> > Or this is intentional to test an abnormal filter CE_OUT condition? I cannot imagine it now. Could you tell me that if that is right?

>
>
>
> Not only will the section under 1c not run, the condition at 1b will
>
> never evaluate as true and so that section can never run either. Unless
>
> there is something I'm missing that would make the structure different
>
> from the indentation this code is rather bogus. How was the code
>
> generated? What are the inputs?
>
>
>
> I would report it to MatLab.
>
>
>
> Rick
>
>
>
>
>
> > ..............

>
> > checker_1: PROCESS(clk, reset)

>
> > BEGIN

>
> > IF reset = '1' THEN

>
> > filter_out_timeout<= 0;

>
> > filter_out_errCnt<= 0;

>
> > filter_out_testFailure<= '0';

>
> > ELSIF clk'event and clk ='1' THEN

>
> > la: IF filter_out_rdenb = '1' THEN

>
> > filter_out_timeout<= 0;

>
> > IF filter_out /= filter_out_expected THEN

>
> > filter_out_errCnt<= filter_out_errCnt + 1;

>
> > filter_out_testFailure<= '1';

>
> > ASSERT FALSE

>
> > REPORT "Error in filter_out: Expected "

>
> > & to_hex(filter_out_expected)

>
> > & " Actual"

>
> > & to_hex(filter_out)

>
> > SEVERITY ERROR;

>
> > IF filter_out_errCnt>= MAX_ERROR_COUNT THEN

>
> > ASSERT FALSE

>
> > REPORT "Number of errors have exceeded the maximum error"

>
> > SEVERITY Warning;

>
> > END IF;

>
> > END IF;

>
> > lb: ELSIF filter_out_timeout> MAX_TIMEOUT AND filter_out_rdenb = '1' THEN

>
> > filter_out_errCnt<= filter_out_errCnt + 1;

>
> > filter_out_testFailure<= '1';

>
> > ASSERT FALSE

>
> > REPORT "Timeout: Data was not received after timeout."

>
> > SEVERITY FAILURE ;

>
> > lc: ELSIF filter_out_rdenb = '1' THEN

>
> > ld: filter_out_timeout<= filter_out_timeout + 1 ;

>
> > le: END IF;

>
> > END IF;

>
> > END PROCESS checker_1;

>
>
>
>
>
> --
>
>
>
> Rick


Thanks both of you. This testbench is for a filter:


u_hcic: hcic
PORT MAP (
clk => clk,
clk_enable => clk_enable,
reset => reset,
filter_in => filter_in,
filter_out => filter_out,
ce_out => h_ce_out );

I have a further question to ask here. I have several years experience of digital circuits design, including EPLD and small implementation on FPGA. For testbench, I assumed it was not a big problem at all in the past. Occasionally I programmed small VHDL code. I used Matlab/Simulink for a medium algorithm project. Recently, I realize that there are some importance on the testbench. I do not find a tutorial or book useful for me on this subject.

Conceptually, testbench can test suspicious point/component in a big design.. At least there are some techniques to write code on different hierarchy levels etc. Could you tell me any web site, web links on testbench tutorials, typical examples?

Thanks,
 
Reply With Quote
 
Andy
Guest
Posts: n/a
 
      02-25-2013
I highly recommend "Writing Testbenches: Functional Verification of HDL Models", by Janick Bergeron.

If you plan on writing tesbenches in verilog or VHDL, the first edition (blue cover) is actually better than the second edition (red cover), which has less detail on VHDL/Verilog in favor of other verification languages.

Janick also has a similar book for SystemVerilog, but I am not familiar with it.

You might also be interested in Open Source VHDL Verification Methodology (OSVVM.org). It is a VHDL library of packages written by Jim Lewis for constrained random pattern generation and coverage modeling.

Andy
 
Reply With Quote
 
Reuven
Guest
Posts: n/a
 
      02-27-2013
On Monday, February 25, 2013 10:41:26 AM UTC-8, Andy wrote:
> I highly recommend "Writing Testbenches: Functional Verification of HDL Models", by Janick Bergeron.
>
>
>
> If you plan on writing tesbenches in verilog or VHDL, the first edition (blue cover) is actually better than the second edition (red cover), which has less detail on VHDL/Verilog in favor of other verification languages.
>
>
>
> Janick also has a similar book for SystemVerilog, but I am not familiar with it.
>
>
>
> You might also be interested in Open Source VHDL Verification Methodology (OSVVM.org). It is a VHDL library of packages written by Jim Lewis for constrained random pattern generation and coverage modeling.
>
>
>
> Andy


I also recommend using the OVL library for verification. Use the VHDL only checkers is you only have a VHDL simulator license.
 
Reply With Quote
 
HT-Lab
Guest
Posts: n/a
 
      02-28-2013
On 27/02/2013 20:47, Reuven wrote:
> On Monday, February 25, 2013 10:41:26 AM UTC-8, Andy wrote:
> ....
> I also recommend using the OVL library for verification. Use the VHDL only checkers is you only have a VHDL simulator license.
>

Sorry for the people who worked hard on the OVL but I actually wouldn't
recommend it, at least not to everybody. If you are serious about
assertions and functional verification than dive straight into PSL or SVA.

When I tried the latest OVL library I was actually struggling to get a
simple checker working. Only when I played with the ovl_ctrl_record did
I managed to get it up and running. The same checker was just a single
line of PSL (excluding the default clock statement etc).

Another slight disadvantage is that a large number of VHDL checkers call
the Verilog version and hence you need a dual language license.

Get yourself Modelsim DE or the Aldec equivalent and start using PSL,
you can pick up basic PSL in just a few hours, it is not difficult.

What would be great if Doulos decided to allocate one of their free 1
hour training courses to PSL (I know they read this newsgroup

Hans
www.ht-lab.com
 
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
Does Code in a Separate Thread Have to be in a <run()> or Called by a <run()>? KevinSimonson Java 7 10-18-2010 06:39 PM
Newbie: if / elseif planetthoughtful Ruby 10 03-16-2007 11:05 PM
elseif v. elsif ?? 7stud 7stud Ruby 83 03-13-2007 02:58 PM
elseif problem simonced Ruby 7 06-03-2006 07:50 PM
ElseIF or Case Statement? Leon ASP .Net 5 12-17-2004 05:33 PM



Advertisments