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 

single cycle rule

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



Joined: 29 May 2012
Posts: 56

PostPosted: Thu Nov 15, 2012 5:38 am    Post subject: single cycle rule Reply with quote

hi,
If I have a number of rules in a defined interface and I want to execute at each clock cycle only one rule for example:
rule1,rule2,rule3
I want rule1 to be executed first then the result from this rule we be used in rule2 but rule 2 will be executed in the second clock cycle and so on how to do that?
does this guarantee that:

Code:
(* execution_order = "rule1, rule2, rule3" *)

or it maybe do the 3 rules in the same clock cycle but in the order above
thanks in advance
Back to top
View user's profile Send private message
hadar_agam



Joined: 10 May 2007
Posts: 38

PostPosted: Thu Nov 15, 2012 12:47 pm    Post subject: Reply with quote

It sounds like you need a state machine in order to keep track of what's going on; I can think of two ways to go:

1. Use the StmtFSM package (see reference guide)
2. Instantiate a register to keep track of state. Have each one of your rules depend on a different state of that register, and have each rule update it:

Reg#(Int#(4)) state <- mkReg(0);

rule r1 (state == 0);
.
.
.
state <= 1;
endrule

rule r2 (state == 1);
.
.
.
state <= 2;
endrule


as for execution_order - it has to do with the ordering of rules which fire in the same clock cycle. More on that here:
https://sites.google.com/a/bluespec.com/learning-bluespec/Home/Attributes/execution-order-Attribute
Back to top
View user's profile Send private message Visit poster's website
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