 |
bluespec.com Bluespec Forums
|
| View previous topic :: View next topic |
| Author |
Message |
test001
Joined: 22 May 2008 Posts: 53
|
Posted: Tue Dec 30, 2008 3:25 am Post subject: How to avoid warning 'shadows the effects'? |
|
|
| 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 |
|
 |
jnewbern
Joined: 18 Jul 2007 Posts: 66
|
Posted: Tue Dec 30, 2008 12:09 pm Post subject: |
|
|
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 |
|
 |
test001
Joined: 22 May 2008 Posts: 53
|
Posted: Tue Dec 30, 2008 10:26 pm Post subject: |
|
|
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 |
|
 |
|
|
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
|
Powered by phpBB © 2001, 2005 phpBB Group
|