Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Inconsistency with iverilog in Gentoo?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
ZHQ
n00b
n00b


Joined: 31 Dec 2009
Posts: 58
Location: Here

PostPosted: Fri Nov 18, 2011 11:43 pm    Post subject: Inconsistency with iverilog in Gentoo? Reply with quote

Hi all,

I've been using icarus verilog (iverilog) for a few months and it looks like there's an inconsistency between this and the Red Hat version of iverilog. I'm trying to simulate the follow pieces of code that synthesize without issue on Red Hat (work computer), but gives me errors (see below) when I synthesize on my Gentoo desktop. I was just wondering if this is a known issue with iverilog on Gentoo or if I'm doing something wrong...

The offender appears in this flipflop. I follow the code through the `VC_ASSERT_NOT_X_POSEDGE_MSG macro which has a `VC_ASSERT_NOT_X_POSEDGE_MSG macro that also uses a `VC_ASSERT_NOT_X_MSG macro and then finally ends in the `VC_ERROR macro.

Code:
//------------------------------------------------------------------------
// Postive-edge triggered flip-flop with enable
//------------------------------------------------------------------------

module vc_EDFF_pf #( parameter W = 1 )
(
  input              clk,     // Clock input
  input      [W-1:0] d_p,     // Data input (sampled on rising clk edge)
  input              en_p,    // Enable input (sampled on rising clk edge)
  output reg [W-1:0] q_np     // Data output
);

  always @( posedge clk )
    if ( en_p ) q_np <= d_p;

  `ifndef SYNTHESIS
    `VC_ASSERT_NOT_X_POSEDGE_MSG( clk, en_p, "en_p" );
  `endif

endmodule


In `VC_ASSERT_NOT_X_POSEDGE_MSG:

Code:
`define VC_ASSERT_NOT_X_POSEDGE_MSG(clk, net, msg) \
  always @(posedge clk) \
    `VC_ASSERT_NOT_X_MSG(net, msg)


In `VC_ASSERT_NOT_X_MSG:

Code:
`define VC_ASSERT_NOT_X_MSG(net, msg) \
  if ((|(net ^ net)) == 1'b0); \
  else `VC_ERROR( ({"x assertion failed : ",msg}) )


and finally in VC_ERROR:

Code:
`define VC_ERROR(msg) \
  if ($time > `VC_ERROR_CHECK_START_TIME) \
    $display( " RTL-ERROR ( time = %d ) %m : %s", $time, msg )


The error I'm getting when synthesizing on Gentoo is:

Code:
iverilog -g2005 -Wall -Wno-sensitivity-entire-vector -Wno-sensitivity-entire-array -o imuldiv-iterative-sim -I ../imuldiv -I ../vc -I ../mtldev -I ../lcd ../imuldiv/imuldiv-iterative-sim.v
../vc/vc-StateElements.v:59: error: wrong number of arguments for `VC_ERROR
../vc/vc-StateElements.v:81: error: wrong number of arguments for `VC_ERROR
../vc/vc-StateElements.v:118: error: wrong number of arguments for `VC_ERROR
../vc/vc-StateElements.v:164: error: wrong number of arguments for `VC_ERROR
../vc/vc-StateElements.v:210: error: wrong number of arguments for `VC_ERROR


The line numbers cited are where the posedge flip flop is used. A few points I want to ask:

1) Is there any known issue that would cause this? e.g., a purposeful discrepancy between iverilog on the Gentoo specific brand that was done in light of software/system constraints?

2) I think the offending line is in the `VC_ERROR define. More specifically, the calling function `VC_ASSERT_NOT_X_MSG does some odd concatenation thing to pass the VC_ERROR macro one string. Could iverilog be incorrectly interpreting this as 2 strings? (Or is my code using bad practices?)

3) Verilog question: {"x assertion failed : ",msg}

I'm assuming the above is a concatenation of strings, but I've never actually read anywhere that this was so. Is this actually doing something I'm not expecting?

4) Verilog question 2: $display( " RTL-ERROR ( time = %d ) %m : %s", $time, msg )

It is possible that the error lies here instead. I see 3 tokens, but only 2 variables to fill those tokens. Is the Red Hat version incorrect and Gentoo's version correctly catching a mistake? Maybe the code in 3) is actually a tuple of strings and msg somehow fulfills 2 tokens?

5) Thanks a lot for your help! I hope people read this long post... >.>
Back to top
View user's profile Send private message
Hu
Watchman
Watchman


Joined: 06 Mar 2007
Posts: 8982

PostPosted: Sat Nov 19, 2011 3:49 am    Post subject: Reply with quote

What version of sci-electronics/iverilog are you using? Do you have the same version on Red Hat? What version of Red Hat are you using?
Back to top
View user's profile Send private message
ZHQ
n00b
n00b


Joined: 31 Dec 2009
Posts: 58
Location: Here

PostPosted: Mon Nov 28, 2011 7:32 am    Post subject: Reply with quote

Whoops! Sorry for the late reply. I forgot about this topic because I was busy with projects and traveling...

So, on my gentoo machine, the version of iverilog is 0.9.1 (v0_9_1).

On the red hat linux install, the version of iverilog is 0.9.4 (v0_9_4).

Hmm. That explains a lot I guess. I can upgrade to 0.9.3 if I mask the 0.9.1 version. Do you think this will help? (I don't know if it's stable enough to use for something important... I don't really want to break anything else right now. :S)

Thank you for your patience!
Back to top
View user's profile Send private message
Hu
Watchman
Watchman


Joined: 06 Mar 2007
Posts: 8982

PostPosted: Tue Nov 29, 2011 4:14 am    Post subject: Reply with quote

It might. Red Hat has a reputation for backporting patches, so it is difficult to know if the v0.9.4 they gave you is equivalent to the v0.9.4 that you could build from upstream. If Gentoo is still on v0.9.3, you will need to prepare an ebuild for v0.9.4. When things work well, you can just copy the ebuild to the new name and it will work. If not, additional debugging may be required. Since you seem inexperienced, I should point out that if you want to set up a v0.9.4 ebuild, then you should place it in a local overlay to avoid having it deleted when you next run emerge --sync. You could also try keywording the v0.9.3 ebuild to see if that is close enough to do what you want.
Back to top
View user's profile Send private message
ZHQ
n00b
n00b


Joined: 31 Dec 2009
Posts: 58
Location: Here

PostPosted: Tue Nov 29, 2011 4:18 am    Post subject: Reply with quote

Ah okay. Thanks!

I'll emerge 0.9.3 when I get a free moment and see if that helps. If not, I'll maybe look into making a 0.9.4 ebuild for next year.

Thanks for your help!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum