Last active
December 27, 2015 23:11
-
-
Save brianhill11/6820095fc7d0ca6fbfa1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Author: Brian Hill | |
* Date: | |
* Module: conv_forward | |
* Desc: Apply each filter in set of filters to image by computing dot | |
product between patch of image and filter | |
*/ | |
module conv_forward( input logic clk, | |
input logic reset, | |
input logic [31:0] filter [KERNEL_WIDTH*KERNEL_HEIGHT-1:0], | |
input logic [31:0] in_data [IN_WIDTH-1:0], | |
output logic [31:0] out_data[OUT_WIDTH-1:0]); | |
for w = 1 to W //for each pixel in image row | |
for h = 1 to H //for each row in image | |
for k_w = 1 to K //for each pixel in filter row | |
for k_h = 1 to K //for each row in filter | |
for m = 1 to M //for each filter in set of filters | |
for d = 1 to D //for each dimension (i.e. 3 for RGB) | |
//apply filter to image | |
output(w, h, m) += input(w + k_w, h + k+h, d) * filter(m, k_w, k_h, d) | |
endfor | |
endfor | |
endfor | |
endfor | |
endfor | |
endfor |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment