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 

Indexing an array of BRAMs question

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



Joined: 28 Sep 2011
Posts: 4

PostPosted: Fri Apr 13, 2012 8:24 pm    Post subject: Indexing an array of BRAMs question Reply with quote

Hello everyone.

I'm making a system to invert a matrix, and my teacher told me to do as each line of the matrix as being a BRAM

so i've made an array of BRAMs, and this matrix is stored twice on different BRAMS, so something like an NxN Matrix would be an array [2][n], each bram of size n:

BRAM_Configure cfg = defaultValue;
cfg.memorySize = n;
BRAM2Port#(UInt#(nbt), t) x[2][n+1];

(...)

/* Creating the BRAMs */
for(Integer i = 0; i < n+1; i = i+1) begin
x[0][i] <- mkBRAM2Server(cfg);
x[1][i] <- mkBRAM2Server(cfg);
end


(...)

then, i have a method to put an element on the matrix, that works well i guess:

method Action put_elem(t a, UInt#(nbt) i, UInt#(nbt) j);
x[0][i].portA.request.put(BRAMRequest{write:True, responseOnWrite:False, address:j, datain:a});
endmethod


and two methods to retrieve an specific element, one for requesting the (i,j) address, and the other to get the value itself:

method Action get_request(UInt#(nbt) i, UInt#(nbt) j) if (flagdone == 1);
x[0][i].portB.request.put(BRAMRequest{write:False, responseOnWrite:False, address:j, datain:?});
ri <= i;
endmethod


I'm storing the i index on an register, because i have to know in which BRAM I'm going to take de the result:

method ActionValue#(t) get() if (flagdone == 1);
let res <- x[0][ri].portB.response.get;
return res;
endmethod


the main problem is that after i request the (i,j), the rule that contains the get method never runs, and my simulation never ends.

I appreciate any help!
Back to top
View user's profile Send private message
quark
Site Admin


Joined: 02 Nov 2007
Posts: 499

PostPosted: Sat Apr 14, 2012 12:39 am    Post subject: Re: Indexing an array of BRAMs question Reply with quote

Make sure that you're using the flag -aggressive-conditions. Otherwise, the "get" method requires all N ports to be ready to get data, not just the ri-th port.
Back to top
View user's profile Send private message
comododragon



Joined: 28 Sep 2011
Posts: 4

PostPosted: Sat Apr 14, 2012 1:10 am    Post subject: Reply with quote

I wasn't using this flag, thank you!

But, in the meantime, i've solved my problem by changing from BRAMServer to BRAMCore...
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