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 

how to convert Integer to Bit#(n)?

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



Joined: 05 Jun 2012
Posts: 1

PostPosted: Sat Jun 09, 2012 3:29 am    Post subject: how to convert Integer to Bit#(n)? Reply with quote

I tried following codes.

function Maybe#(Bit#(5) search(..);
Maybe#(Bit#(5)) result = tagged Invalid;
for(Bit#(5) i=0; i< IntegerToBit(valueOf(type_i));i=i+1) begin
...
result = tagged Valid i;
end
return result;
endfunction

But I can not find how to convert Integer to Bit.
Back to top
View user's profile Send private message
chiraag



Joined: 06 Aug 2011
Posts: 29

PostPosted: Sun Jun 10, 2012 7:40 am    Post subject: Reply with quote

Perhaps you are looking for:
Code:

fromInteger(valueOf(type_i))
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