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: relu_backprop | |
* Desc: The backpropagation calculation for the ReLU layer | |
* using single precision floating point values | |
*/ | |
module relu_backprop( input logic clk, | |
input logic [31:0] in_data[WIDTH-1:0], | |
output logic [31:0] out_data[WIDTH-1:0]) |
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
/* union for picking off parts of single-precison floating point value */ | |
union { | |
int unsigned x; | |
struct packed { | |
bit sign; | |
bit [7:0] exp; | |
bit [22:0] mantissa; | |
} parts; | |
} my_union; |
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], |
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 | |
* Desc: | |
Apply filter to a section of image by computing dot product | |
of filter and pixel values | |
* Parameters: | |
input_data: array of 32-bit floating-point values representing | |
pixel intensities | |
weights: array of 32-bit floating-point values representing the | |
filter pixel weights | |
bias_term: 32-bit floating-point value for biasing the |
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
module read_file_test_top(); | |
parameter NUM_TESTS = 10000; | |
parameter NUM_COLS = 3; | |
parameter MEM_SIZE = NUM_TESTS*NUM_COLS; | |
reg [31:0] mem [MEM_SIZE]; | |
int i; | |
initial begin |
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
#!/usr/bin/python | |
import csv | |
import random | |
import struct | |
NUM_TESTS = 10000 | |
filename = 'quartus_test_data.hex' | |
def main(): |
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
#!/usr/bin/python | |
import csv | |
import random | |
import struct | |
NUM_TESTS = 10000 | |
filename = 'quartus_test_data.hex' | |
UPPER_RANGE = 100 | |
LOWER_RANGE = -100 |
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
#!/usr/bin/python | |
import csv | |
import random | |
import struct | |
import numpy as np | |
import argparse | |
data_file_name = 'test_data/conv_forward_test_data.hex' |
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
#!/usr/bin/python | |
import csv | |
import random | |
import struct | |
import argparse | |
data_file_name = 'test_data/relu_backward_test_data.hex' | |
# convert floating point value to hex value |
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
#!/usr/bin/python | |
import csv | |
import random | |
import struct | |
import numpy as np | |
import argparse | |
data_file_name = 'test_data/pooling_forward_test_data.hex' |
OlderNewer