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 

define

 
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: Sat Aug 25, 2012 6:45 am    Post subject: define Reply with quote

Is there any way to do define as in c :
define number 4;
in the code:
x=x+number;
Back to top
View user's profile Send private message
hadar_agam



Joined: 10 May 2007
Posts: 38

PostPosted: Sat Aug 25, 2012 8:47 am    Post subject: Reply with quote

Yes, you may do that as long as "x" and "number" are of the same type:

Code:
UInt#(16) x = 10;
UInt#(16) number = 8;
let x = x+number;

Note that since you are using the "+" operator, the type (in this case - UInt#(16)) - should be a member of the arith typeclass.
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