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.

vhdl code for convolution a matrix by a vector or filt help

Status
Not open for further replies.

MOOMOO_KAMP81

Junior Member level 3
Joined
Feb 16, 2010
Messages
26
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Iran
Activity points
1,463
i shoul use a convolution in my project that need to convolve an 2-d image by a filter wich is symmetric and have 12 tap and all of its 12 values are constant.



can any one help me or do u have some code?
 

Re: vhdl code for convolution a matrix by a vector or filt h

it is a 1d filter with constamt number wich have negative number
 

use signed multiplication:

signal a, b : signed(n-1 downto 0);
signal c : signed(2*n-1 downto 0);

c <= a * b;
 

Re: vhdl code for convolution a matrix by a vector or filt h

but my image is a matrix type which is nubmers between 0 to 255 ,is'nt it going to be wrong if i make them signed?
 

If your image is a matrix, then I assume you are not implementing it on an FPGA and just doing testbenching?

For an FPGA, you have to stream the pixels 1 by 1.
 

Re: vhdl code for convolution a matrix by a vector or filt h

i should write a synthisizable code for fpga my data type for image and filter is :

type matrix is array (nxr-1 downto 0,nxc-1 downto 0) of std_logic_vector(7 downnto 0)
type int_vector is array (integer range<> ) of std_logic_vector(15 downnto 0)

temprorily i read my image from file in test bench

now what should i do for multiplyig these types by * or if i should change my type tell me how?

what do u mean by streaming the pixels 1 by 1?
 

how are you going to load the pixels into the FPGA when it runs?
 

Re: vhdl code for convolution a matrix by a vector or filt h

i havent done that untill now,and i dont know,now i m just trying to implement the convolution.

but i think it should be read sequentilly from ram in each clk cycle
 

exactly, so when you implement it you dont need an array - the convolution will occur as the pixels move through the pipeline
 
Re: vhdl code for convolution a matrix by a vector or filt h

i cant understand what you mean exactly,could you explain more!
 

I think this is what he meant:
Take each pixel do the calculation for convolution and go for the next pixel.So here you dont need an array(or a buffer to store all the pixels first and then proceed) for storing all the pixels.after getting the first pixel itself you can start the calculation.
 
hi
i also need similar 2d convolution implementation,, can anybody help in what type of multipliers and adders must be used in order to optimize the design???
thnku
 

thnks
Now i want to know that how to give the image as input ??? i created a text file and tried to read it .But i do not know how to use this for simulations??? do i need to store it in RAm ??if so then how??? pls guide me??
 

There are plenty of tutorials on how to use textio in VHDL testbenches, or in verilog.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top