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 

Clock and mkGatedClock

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



Joined: 13 Jun 2011
Posts: 16

PostPosted: Sat Apr 27, 2013 5:01 am    Post subject: Clock and mkGatedClock Reply with quote

Hi all, i have a little question about the use of mkGatedClock module, in some lectures i've find the following code:

Code:
Bool b = True;
Clock c0 <- mkGatedClock(b);
Bool b1 = True;
Clock c1 <- mkGatedClock(b1, clocked_by c0);


but apparently it does not compile, the compiler return:

Code:
Wrong number of arguments in the use of the following function:
    mkGatedClock

  The function expects 2 arguments but was used with 1 arguments.
 
  Expected type:
    function a__#(Clocks::GatedClockIfc) f(Bool x1, Clock x2)

  Inferred type:
    function c__#(Clock) f(b__ x1)


Is something changed in the language libraries? i ask this question because in the reference guide the costructor mkGatedClock ask only one argument.
Can some one gives me a tip to resolve this problem?
Back to top
View user's profile Send private message
quark
Site Admin


Joined: 02 Nov 2007
Posts: 499

PostPosted: Sat Apr 27, 2013 12:57 pm    Post subject: Re: Clock and mkGatedClock Reply with quote

The module "mkGatedClock" takes two arguments, the Bool and the Clock. If you want to make a gated version of the current clock ("CC") then you can use "mkGatedClockFromCC", which only takes one argument.

The type shown in the Reference Guide is correct, and it indicates two arguments:
Code:
module mkGatedClock#(Bool v) ( Clock clk_in, GatedClockIfc ifc );

Yes, there is only one parameter argument, but if you look in the port list (the second set of parentheses), there is also one port argument. The last identifier in the port list is the interface provided by the module. This is a bit confusing, I apologize.

It looks like the lecture code is incorrect and should have used "mkGatedClockFromCC".
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