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 

Writing a Wrapper module

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



Joined: 21 Aug 2014
Posts: 17

PostPosted: Wed Jun 03, 2015 4:42 am    Post subject: Writing a Wrapper module Reply with quote

i have a top module which has some interfaces passed to it as argument, and its interface is Empty

Code:

module mkBusFabric#(BusIfc a )


and since cant be synthesized, So to synthesize it, i need a wrapper module, in which i would be passing those interface during instantiation of mkBusFabric

First i made an empty module which provides BusIfc interface.

then in wrapper module i wrote
Code:

    BusIfc tb1 <- mkEmptyModule;   //Here it show the error
    Empty  bus2 <- mkBusFabric(tb1,True);


Compiler giving error on this
Expected type:
b__#(Bus::BusIfc)

Inferred type:
a__#(Empty)

Please help
Back to top
View user's profile Send private message
quark
Site Admin


Joined: 02 Nov 2007
Posts: 500

PostPosted: Wed Jun 03, 2015 2:36 pm    Post subject: Re: Writing a Wrapper module Reply with quote

You probably defined 'mkEmptyModule' to return an 'Empty' interface, but you're trying to instantiate it (with '<-') to get a 'BusIfc' interface. Those types don't match, so you get the error.

The 'a_' and 'b_' variable names may be a bit confusing. BSC could probably give a clearer error message. You can think of those variables as the type of the current module and the type of the instantiated module. Consider if the error message had been reported like this:
Code:
Expected type:
Module#(BusIfc)

Inferred type:
Module#(Empty)

The mismatch error is saying that it expected a module that returns 'BusIfc' (because that's the type that you explicitly wrote), but it inferred the type for the expression that you wrote and found it to be a module that returns 'Empty'. The reason that BSC used variable names is because there is more than one module type (not just the basic 'Module'). BSC has an advanced feature for extending the basic module to create your own module types. When you write 'mkmodule..endmodule', unless you specify the module type that you want, it can be any module type. And so a variable shows up, which represents that generic-ness.

Does that explain what was unclear?
Back to top
View user's profile Send private message
gagan



Joined: 21 Aug 2014
Posts: 17

PostPosted: Thu Jun 04, 2015 6:19 am    Post subject: HI Reply with quote

Hi Quark,
Thanks for reply .
I am doing like ...
Code:

module mkEmptymodule(ApbBusIfc);

endmodule:mkEmptymodule
Back to top
View user's profile Send private message
quark
Site Admin


Joined: 02 Nov 2007
Posts: 500

PostPosted: Thu Jun 04, 2015 5:02 pm    Post subject: Re: Writing a Wrapper module Reply with quote

If that's what you've written, then you shouldn't get the error. Maybe you're not importing the right file? (Do you have "mkEmptyModule" defined elsewhere with an Empty interface?) Or maybe you're failing to recompile an out of date imported package? If you're still seeing the error, can you send the code, so that I can try it?
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