bluespec.com Forum Index bluespec.com
Bluespec Forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to avoid warning 'shadows the effects'?

 
Post new topic   Reply to topic    bluespec.com Forum Index -> Designing with BSV's Rules, Interfaces, ...
View previous topic :: View next topic  
Author Message
test001



Joined: 22 May 2008
Posts: 53

PostPosted: Tue Dec 30, 2008 3:25 am    Post subject: How to avoid warning 'shadows the effects'? Reply with quote

Code:

import ConfigReg::*;

(* synthesize *)
module test( Empty );
   
    Reg#(Bit#(8))   step    <- mkConfigReg(0);

    rule r1( step > 7 );
        step <= step + 1;
    endrule

    rule r2( True );
        if (step == 0)
            step <= 1;
    endrule
endmodule


In this code, r1 & r2 can fire both, but step can not modify both, but I got some warning. is it a bug? or my must rewrite with other way.
Back to top
View user's profile Send private message
jnewbern



Joined: 18 Jul 2007
Posts: 66

PostPosted: Tue Dec 30, 2008 12:09 pm    Post subject: Reply with quote

Test001,

This warning is telling you that when both rules fire together, you will see only the effects of one of the writes (whichever was scheduled later). In the particular example you've given the conditional inside the rule ensures that the writes will not actually happen in the same cycle, but the compiler does not analyze the conditionals inside the rule when generating the warning.

As the warning message says, you can disable it by using the -no-warn-action-shadowing flag.

Anyway, I would recommend against using ConfigReg in this way. I would caution you again that you appear to be fighting against the language instead of working with it. There are better ways to encode a state machine than as a separate set of rules manipulating a central step counter. Try StmtFSM, change your microarchitecture to expose some concurrent operations, or write your FSM in a single rule with a big case statement if you absolutely insist on using a low-level RTL-style encoding.

Regards,
Jeff
Back to top
View user's profile Send private message
test001



Joined: 22 May 2008
Posts: 53

PostPosted: Tue Dec 30, 2008 10:26 pm    Post subject: Reply with quote

Thank you!
I known StmtFSM is a good way, but I think write some examples for help verilog programmer to BluespecSystemVerilog.
So I try to rewrite tradition verilog to bsv with less modify.

This warning can off by command flag, but I do not think this a good way, I think not any warning in my code.
I try last night, at the end, I add the rule r3, it use a big 'case' to control variant step(and remove from r1 & r2), I can not get any warning now.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    bluespec.com Forum Index -> Designing with BSV's Rules, Interfaces, ... All times are GMT - 4 Hours
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
You can attach files in this forum
You can download files in this forum
bluespec.com topic RSS feed 


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP