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 

Initialize a BRAM to zero

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



Joined: 24 Sep 2013
Posts: 3

PostPosted: Tue Apr 21, 2015 10:29 am    Post subject: Initialize a BRAM to zero Reply with quote

Is there an easy way to initialize a BRAM to zero? (without writing an initialization file full of zeros)?
By default, Bluesim will initialize the BRAMs to 01010101...

Thank you

EDIT:
I've tried "-unspecified-to 0" but I believe it doesn't work for memories.
Back to top
View user's profile Send private message
quark
Site Admin


Joined: 02 Nov 2007
Posts: 500

PostPosted: Tue Apr 21, 2015 2:57 pm    Post subject: Re: Initialize a BRAM to zero Reply with quote

The Verilog and Bluesim primitives use repeating 1 and 0 as the uninitialized value. There is currently no way to control this. If you want to set the value to 0 you would need to use BRAMLoad and read a file containing all 0. Or, you would need to write an initialization routine into your BSV design, to write 0 to all the RAM locations when it comes out of reset.

The source for the Verilog primitives is given. So for Verilog simulation, you could edit the file for the BRAM. This block, for example in "BRAM1.v", is where that value gets set:
Code:
initial
begin : init_block
   for (i = 0; i < MEMSIZE; i = i + 1) begin
      RAM[i] = { ((DATA_WIDTH+1)/2) { 2'b10 } };
   end
   DO_R  = { ((DATA_WIDTH+1)/2) { 2'b10 } };
   DO_R2 = { ((DATA_WIDTH+1)/2) { 2'b10 } };
end
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