Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

accessing .coe file in xilinx bram-reg

Status
Not open for further replies.

arunshanmugam46

Junior Member level 2
Junior Member level 2
Joined
Jan 8, 2012
Messages
21
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,422
Hi all,
I'm using the Xilinx BRAM CORE GEN to develop project on LDPC DECODER... I would like to ask if anyone knows how i can store external files(.coe file) so that my Verilog program can access the content of the file during run time.
i need to access the content of the memory one by one, such as reading data line by line from the memory.
Please send me an example too if any body is familiar with accessing bram content.
 

Perhaps I don't understand your question, but the .coe file is used to initialize memory in the FPGA when you synthesize the project; it gets embedded in the bit file that is used to program the device. 'run time' is a computer concept, it doesn't really apply to FPGAs. Unless you're talking about running a test bench where you can read data from a file. Can you explain what you are actually trying to do?
 
Perhaps I don't understand your question, but the .coe file is used to initialize memory in the FPGA when you synthesize the project; it gets embedded in the bit file that is used to program the device. 'run time' is a computer concept, it doesn't really apply to FPGAs. Unless you're talking about running a test bench where you can read data from a file. Can you explain what you are actually trying to do?

I used bram for storing the initial llr valuesof ldpc decoder using .coe file...i need to perform operations on these stored values . so i need to access the content in the .coe file ..my que is how to access the content of the value stored in bram
eg:if mem[1]=7
mem[2]=8
i need to use the mem values in my coding.i need to perform operations on the values stored in the bram .coe file..how to perform this ...
 

I still don't understand. If you've initialized the values in BRAM from the coe file, then operate on the values in BRAM. Why do you (even if you could) need to access the .coe file? you've already got those values.
 
I still don't understand. If you've initialized the values in BRAM from the coe file, then operate on the values in BRAM. Why do you (even if you could) need to access the .coe file? you've already got those values.

i need to access each of the value in bram .coe file....how to find the address or location of each stored value...
eg:if values are 3a 4d 09 4f ff in .coe file
i need to operate on 1 and last values (3a and fff)how to do this...thats my doubt..
 

I STILL don't understand. The values in the coe file are stored sequentially in ram. The first value goes in address 0; the second value goes to address 1. Once they are in RAM, WHY DO YOU NEED THE COE FILE????

If you are looking for the LOCATION of a specific value in RAM (are they all unique?) you can:

1) Perform some kind of search (binary, brute-force, etc.); or
2) Use content addressable memory.
 

i need to access each of the value in bram .coe file....how to find the address or location of each stored value...
eg:if values are 3a 4d 09 4f ff in .coe file
i need to operate on 1 and last values (3a and fff)how to do this...thats my doubt..

Do you mean something like this?

3a --> 1
4d --> 2
09 --> 3
4f --> 4
ff --> 5

I think you want something more like the index, am I right?. I presume you know the address of 3a and ff in this case. Use that address to access each value in the BRAM. The address coulbe something like 0x30 and 0x32 etc. Here I think what you are trying to say is to mean the index values of 3a and ff such as 1st data or 5th data. Am i correct?

An index is not necessarily an address
 
ya u are right...how to access the indexx

The one and only way to do that is match the content address with the index. Say if your index value starts with 8,9,10 then add 8 offset value to your memory address and store the content in 0x08 and so on.

For eg., if 3a is 100th data, then ur address needs to be 100 or 0x64. Like this if you match your index and address, you wont have this problem. So next time if want 0xff data which is index value 5, then you will simply point address 0x05.
Done....!!

Cheers

---------- Post added at 12:23 ---------- Previous post was at 12:21 ----------

Update : You can also have proper offset values. Like if your index starts at 15 and goes till 50, then you still read data at address of 1st data by considering the offset of 15 in this context.
 
thanks a lot ..how to find the index and starting address..
 


Let's back up. What, EXACTLY, are you trying to do? You've got all of us confused. Your first request said you wanted to 'read the content of memory one by one', or access your .coe file and now, somehow, we are talking about indexing.

If you are trying to find the specific memory location (address) of a given value, then a content-addressable memory is what you want. Or use a search algorithm.
 

Couple of questions...

1 - Is this for synthesis, or for simulation only? I ask because of the usage of language such as "run time".

Okay, so that's only one question. :p I had to re-read your posts to try to guess what the hell you are trying to do. And not that you explicitly specificied this or anything (gods forfend!), but based on a few randomly dispersed keywords I'd guess this:

- You are doing an EE lab assignment (i.e homework).
- The assignment mention something about "LDPC DECODER" and doing this using the "BRAM CORE GEN".
- The assignment mentioned these things in CAPITALS.
- The LPDC (Low Density Parity Checker) decoder in question will use a lookup table to do it's work
- This lookup table will be stored in Block Ram (hence the BRAM CORE GEN bit).

Warm so far?

Then you write confuzlement inducing stuff about reading line by kline and indexing and all that. Which I will safely ignore. The key sentence methinks is this one: "Please send me an example too if any body is familiar with accessing bram content."

Which I translate into: "Help, I have never worked with block rams. How the hell do I address these buggers and read data?"

Sooo, assuming all this guessing is correct, you have a lookup table in block ram that contains the data for your LDPC decoding. And you just want to read out the lookup table entry at location X. Oooooh, why didn't you say so. :p Clock in read address on the clock posedge, and the data will be available on DOUT on the next clock posedge. :p

Thanks for this puzzle! I was getting bored of sudoku's.
 

Couple of questions...

Thanks for this puzzle! I was getting bored of sudoku's.

Ha ha ha....Too much for being patient? :smile:

From his words, what I understood was that he wanted to read some well known data such as 3a 4d 09 4f ff, etc stored in coe file, which now he wants to store in BRAM and asks us how to read the same value 3a 4d 09 4f ff..?

The answer is quite simple. Since you are writing into BRAM, you know the address for each value. Write 3a into address 0x00, and read 3a at this same address 0x00.

I dont understand what is there to lead for confusion?
 

Ha ha ha....Too much for being patient? :smile:


The answer is quite simple.

The answer is quite simple if the question is quite simply. Is the question quite simple? Now that is the question. The answer to that is not quite simple.

Which is another way of saying, that IFF his question is "How do I address BRAMs?", then the answer is quite simple. As in what I wrote earlier:

Which I translate into: "Help, I have never worked with block rams. How the hell do I address these buggers and read data?"

I dont understand what is there to lead for confusion?

Neither do I. I'm so confused!
 

hi,
i have initialised bram from external file using the following coding
module bramp (clk, we, addr, din, dout);
input clk;
input we;
input [5:0] addr;
input [31:0] din;
output [31:0] dout;
reg [31:0] ram [0:63];
reg [31:0] dout;
initial
begin
$readmemb("bram.mif",ram, 0, 63);
end
always @(posedge clk)
begin
if (we)
ram[addr] <= din;
dout <= ram[addr];
end
endmodule
but i am getting an error unable to read mif file...how to rectify this..

---------- Post added at 16:54 ---------- Previous post was at 16:50 ----------

is there any keyword to find the values stored in bram........what is the purpose of INIT keyword
 

Sounds like it just cannot find the file.

Option 1: use an absolute path just to be sure.

Option 2: copy that bram.mif file to the project root directory.
 

Also do not place project with huge lengthy names which may exceed more than 256 characters in directory. I have faced problems with xilinx in this context.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top