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.

initialization- xilinx block of RAM (BRAM)

Status
Not open for further replies.

hodahussein

Full Member level 2
Joined
Apr 17, 2007
Messages
144
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,298
Activity points
2,276
dear all

can any one help me on this issus
1- i want to know how can i get .COE file from image
2- how can i load this file in block RAM (any tutorial or reference )

wait any reply for importance
best regards
 

Dear Hoda,

I assume you want to store an image in a BRAM...first you can use matlab to obtain the pixels value of the pictures as 0's and 1's. Then you have to write a .coe file, thats a normal text file and you write the values in a certain way to be able to feed it to the BRAM later and save the txt file as .coe. Please check **broken link removed**

to load it in the BRAM please check this

Eshbon
 
hi

thank's for reply


after block RAM initialization done , how can i use this IP core created
in VHDL code which is responsible for read image from BRAM and send it to VGA ?

wait you reply for importance
regards
 
what are you exactly asking about?..I do not completely understand your question

what do you mean by send it to VGA

to read from the BRAM you created, you have to give an address to the BRAM address inputport and the value in the memory corresponding to that address will be on the output port of the BRAM
 

dear eshbonzie

let me explain what i mean:
my application in image processing
so, loading or store image in BRAM was the 1st step, then apply some processing on it
then display it again on lcd or any CRT through VGA interface.

my questions
1-you said previously; how can i create the .coe file ;[must obtain the pixels value of the pictures as 0's and 1's]. are you mean binary form? if right this causing that ;losing gray scale of an image if i have an image with gary scale not balck and white
please explain this point


2-how can i display an image on lcd or any display?

best regards
 

my questions
1-you said previously; how can i create the .coe file ;[must obtain the pixels value of the pictures as 0's and 1's]. are you mean binary form? if right this causing that ;losing gray scale of an image if i have an image with gary scale not balck and white
please explain this point

Well..I am not quite sure that I comletely understand what you are asking about however let me tell you...you might need to go quickly through **broken link removed**

and let me explain a little bit...you have a Grayscale picture which contains different intensities of black and white but no colors in it...you can easily understand what I mean if you searched for grayscale picture examples on google!

Each pixel in the grayscale pic holds a value from 0 to 255 which correspond to the different intensity from black to white..also read THIS

so each pixel(ranging from 0 to 255) in the grayscale image you can represent in 8 bits(1 byte)...there is a matlab function(I do not recall it now) which extract this value...I believe you will find it easily

If your picture is NOT grayscale and its RGB(colered image) where R stand for Red and G for Green and B for Blue...then you will be having three different frames for the picture where each frame represents a color(R or G or B) and again each pixel will have three different values each representing intensity of the color R, G and B
the intensity of each color is again 8 bits(ranges from 0 to 255). This might be also helpfull.

you have to extract the three frames(R, G and B) of an RGB picture in matlab using also a function (I do not recall it now as well :)) ) first and then read the different intensities of the different colors for each pixel.

so based on the previuos cases you can configure your BRAM as you want. If it is grayscale image, then you can simply store each pixel(the binary value of the intensity) in a memory location. If it is RGB picture, one solution would be store the R, G and B values in one memory location or another solution would be create three different BRAMs for the R, G and B..IU believe that setting up your memory is completely based on what you want to do.

Concerning displaying the image...I actually does not have something in mind to tell you as I didnt face it yet..however I think its not a big issue to do you just need to search on how to use your VGA interface and send something to a screen

Eshbon!
 

dear eshbonzie:

thank's for reply

Now, i created the .coe file for an image and use it in core generator to initialize BRAM
but now i need to read data from BRAM , how can do this process in VHDL code? any tutorial or reference for this issus

wait your reply for importance
regards
 

component MemoryBlock IS
port (clka : IN STD_LOGIC;
wea : IN STD_LOGIC_VECTOR(0 downto 0);
addra : IN STD_LOGIC_VECTOR(3 downto 0);
dina : IN STD_LOGIC_VECTOR(23 downto 0);
douta : OUT STD_LOGIC_VECTOR(23 downto 0));
end component MemoryBlock;

Cntrl: process(clk)
begin

if (CLK'event and CLK='1') then

case Ctl_Counter_Sig is

------------------------------------------------------------------------------------------------
------------------------------------ WRITING TO BlockMemory ------------------------------------
------------------------------------------------------------------------------------------------

----------------------------------------------------------
------------------------ cycle 01 ------------------------
----------------------------------------------------------
when "00001" =>
wea_s <= "1";
dina_s(23 downto 16) <= Pixel01;

----------------------------------------------------------
------------------------ cycle 02 ------------------------
----------------------------------------------------------
when "00010" =>
memoryAddr_s <= "0000";
dina_s(23 downto 16) <= Pixel02;

----------------------------------------------------------
------------------------ cycle 03 ------------------------
----------------------------------------------------------
when "00011" =>
memoryAddr_s <= "0001";
dina_s(23 downto 16) <= Pixel03;

----------------------------------------------------------
------------------------ cycle 04 ------------------------
----------------------------------------------------------
when "00100" =>
memoryAddr_s <= "0010";
dina_s(23 downto 16) <= Pixel04;

----------------------------------------------------------
------------------------ cycle 05 ------------------------
----------------------------------------------------------
when "00101" =>
memoryAddr_s <= "0011";
dina_s(23 downto 16) <= Pixel05;

----------------------------------------------------------
------------------------ cycle 06 ------------------------
----------------------------------------------------------
when "00110" =>
memoryAddr_s <= "0100";
dina_s(23 downto 16) <= Pixel06;

----------------------------------------------------------
------------------------ cycle 07 ------------------------
----------------------------------------------------------
when "00111" =>
memoryAddr_s <= "0101";
dina_s(23 downto 16) <= Pixel07;

----------------------------------------------------------
------------------------ cycle 08 ------------------------
----------------------------------------------------------
when "01000" =>
memoryAddr_s <= "0110";
dina_s(23 downto 16) <= Pixel08;

----------------------------------------------------------
------------------------ cycle 09 ------------------------
----------------------------------------------------------
when "01001" =>
memoryAddr_s <= "0111";
dina_s(23 downto 16) <= Pixel09;

----------------------------------------------------------
------------------------ cycle 10 ------------------------
----------------------------------------------------------
when "01010" =>
memoryAddr_s <= "1000";
dina_s(23 downto 16) <= Pixel10;

----------------------------------------------------------
------------------------ cycle 11 ------------------------
----------------------------------------------------------
when "01011" =>
memoryAddr_s <= "1001";
dina_s(23 downto 16) <= Pixel11;

----------------------------------------------------------
------------------------ cycle 12 ------------------------
----------------------------------------------------------
when "01100" =>
memoryAddr_s <= "1010";
dina_s(23 downto 16) <= Pixel12;

----------------------------------------------------------
------------------------ cycle 13 ------------------------
----------------------------------------------------------
when "01101" =>
memoryAddr_s <= "1011";

wea_s <= "0";

--------------------------------------------------------------------------------------------------
------------------------------------ READING FROM BlockMemory ------------------------------------
--------------------------------------------------------------------------------------------------

--Takes two clock cycles to read from the Block Memory
----------------------------------------------------------
------------------------ cycle 14 ------------------------
----------------------------------------------------------
when "01110" =>
memoryAddr_s <= "0000";

----------------------------------------------------------
------------------------ cycle 15 ------------------------
----------------------------------------------------------
when "01111" =>
memoryAddr_s <= "0001";
pixels_Bitstream_s(95 downto 88) <= douta_s(23 downto 16);

----------------------------------------------------------
------------------------ cycle 16 ------------------------
----------------------------------------------------------
when "10000" =>
memoryAddr_s <= "0010";
pixels_Bitstream_s(87 downto 80) <= douta_s(23 downto 16);

----------------------------------------------------------
------------------------ cycle 17 ------------------------
----------------------------------------------------------
when "10001" =>
memoryAddr_s <= "0011";
pixels_Bitstream_s(79 downto 72) <= douta_s(23 downto 16);

----------------------------------------------------------
------------------------ cycle 18 ------------------------
----------------------------------------------------------
when "10010" =>
memoryAddr_s <= "0100";
pixels_Bitstream_s(71 downto 64) <= douta_s(23 downto 16);

----------------------------------------------------------
------------------------ cycle 19 ------------------------
----------------------------------------------------------
when "10011" =>
memoryAddr_s <= "0101";
pixels_Bitstream_s(63 downto 56) <= douta_s(23 downto 16);

----------------------------------------------------------
------------------------ cycle 20 ------------------------
----------------------------------------------------------
when "10100" =>
memoryAddr_s <= "0110";
pixels_Bitstream_s(55 downto 48) <= douta_s(23 downto 16);

----------------------------------------------------------
------------------------ cycle 21 ------------------------
----------------------------------------------------------
when "10101" =>
memoryAddr_s <= "0111";
pixels_Bitstream_s(47 downto 40) <= douta_s(23 downto 16);

----------------------------------------------------------
------------------------ cycle 22 ------------------------
----------------------------------------------------------
when "10110" =>
memoryAddr_s <= "1000";
pixels_Bitstream_s(39 downto 32) <= douta_s(23 downto 16);

----------------------------------------------------------
------------------------ cycle 23 ------------------------
----------------------------------------------------------
when "10111" =>
memoryAddr_s <= "1001";
pixels_Bitstream_s(31 downto 24) <= douta_s(23 downto 16);

----------------------------------------------------------
------------------------ cycle 24 ------------------------
----------------------------------------------------------
when "11000" =>
memoryAddr_s <= "1010";
pixels_Bitstream_s(23 downto 16) <= douta_s(23 downto 16);

----------------------------------------------------------
------------------------ cycle 25 ------------------------
----------------------------------------------------------
when "11001" =>
memoryAddr_s <= "1011";
pixels_Bitstream_s(15 downto 8) <= douta_s(23 downto 16);

----------------------------------------------------------
------------------------ cycle 26 ------------------------
----------------------------------------------------------
when "11010" =>
pixels_Bitstream_s(7 downto 0) <= douta_s(23 downto 16);
centerPixel_s <= CenterPixel;

when others =>

end case;
end if;
end process;

MemBlk: MemoryBlock
port map (clka => Clk,
wea => wea_s,
addra => memoryAddr_s,
dina => dina_s,
douta => douta_s);

--------------------------------------------------------------

This is an example of writing and reading to a block memory...

First you have to use the BRAM you already created as an entity in your code and as you can see in the code, you write a '1' to the wea_s supply and address and then write the data to it on the dina_s.

when you want to read you put a write a '0' to the wea_s and then give an address and the corresponding values in the memory location will be on the douta_s
 
dear eshbonzie:

thank's for reply
in read from BRAM what about "wea", is it high or low?
also in read from BRAM, each data out read from must be store in buffer or not ? and in case i want to display this data on lcd, should be read all data from BRAM and store it in buffer and then display it or not, where i see it take many resources from fpga, becuse i have 3000 byte need to display it?
can you also tell me how can interface with VGA?

wait your help
best regards
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top