Skip to content
This repository was archived by the owner on Aug 21, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
407d364
Create ProjectProposal.md
poosomooso Nov 28, 2017
d9790b0
dot product whoooo
poosomooso Nov 30, 2017
a7465c3
Ignore auto-generated files (ie gtkwave and compiled verilog)
arianaolson419 Dec 7, 2017
fe1c0d5
Create makefile for compiling verilog
arianaolson419 Dec 7, 2017
32560ed
Add testbench
arianaolson419 Dec 7, 2017
2e9e01f
Create core multiplication module
arianaolson419 Dec 7, 2017
3080450
Parameterize and add header comments
arianaolson419 Dec 7, 2017
188a2b0
Add test cases
arianaolson419 Dec 7, 2017
306e9ce
Parameterize and add header comments
arianaolson419 Dec 7, 2017
58aa6fc
Add script for running test benches
arianaolson419 Dec 7, 2017
e18f898
Add description of how to run tests and use makefile
arianaolson419 Dec 7, 2017
1436000
Fix header comment syntax error
arianaolson419 Dec 7, 2017
9b350d5
Fix typo
arianaolson419 Dec 7, 2017
622219d
Fied transpose issue
arianaolson419 Dec 7, 2017
029da11
creating docs folder
poosomooso Dec 8, 2017
86f4c22
Set theme jekyll-theme-midnight
poosomooso Dec 8, 2017
551b8cd
Add data memory implementation and tests
arianaolson419 Dec 8, 2017
a5996a7
Create test memory for testbench
arianaolson419 Dec 8, 2017
cb61d00
Update to include data memory
arianaolson419 Dec 8, 2017
4756e3b
Change test matrix to not be symmetric
arianaolson419 Dec 8, 2017
6792931
added some words
rdiverdi Dec 8, 2017
5cc3218
Instantiate module
arianaolson419 Dec 8, 2017
bf59ab0
Add todo
arianaolson419 Dec 8, 2017
4e00079
Merge branch 'master' of https://github.com/poosomooso/FinalProject
arianaolson419 Dec 8, 2017
eaa9a21
putting index.md in the right place
poosomooso Dec 8, 2017
b914f63
reg file done
poosomooso Dec 9, 2017
301e3ab
Merge branch 'master' of https://github.com/poosomooso/FinalProject
poosomooso Dec 9, 2017
16400b0
Create modules for accessing block of memory
arianaolson419 Dec 9, 2017
acc45b3
Create test memory for data_memory.t.v
arianaolson419 Dec 9, 2017
db8f826
Change name
arianaolson419 Dec 9, 2017
505cd49
Add todo comment
arianaolson419 Dec 9, 2017
745f773
Add build target for load block
arianaolson419 Dec 9, 2017
afa73a8
Modify to take 9 data entries at a time
arianaolson419 Dec 10, 2017
7887740
create test bench
arianaolson419 Dec 10, 2017
b9637b0
Create potential test data
arianaolson419 Dec 10, 2017
ee7f124
Fix spelling typos
arianaolson419 Dec 10, 2017
2726bbd
Fix addressing scheme
arianaolson419 Dec 10, 2017
95a1895
Merge branch 'master' of https://github.com/poosomooso/FinalProject
arianaolson419 Dec 10, 2017
2d03fe0
added tests for load_block and included them in run_tests.sh
rdiverdi Dec 10, 2017
3457f3a
added register tests to scripts
poosomooso Dec 10, 2017
abbc619
Merge branch 'master' of https://github.com/poosomooso/FinalProject
poosomooso Dec 10, 2017
ad330df
Merge branch 'master' of https://github.com/poosomooso/FinalProject
poosomooso Dec 10, 2017
f2c2e64
added fsm and tests, still need a program memory and program counter …
rdiverdi Dec 10, 2017
b15a708
Remove size registers and update tests
arianaolson419 Dec 10, 2017
b74f810
Resolve TODO
arianaolson419 Dec 10, 2017
c047a4e
Add build target
arianaolson419 Dec 10, 2017
7176117
Merge branch 'master' of https://github.com/poosomooso/FinalProject
arianaolson419 Dec 10, 2017
09c0425
Create and test adder
arianaolson419 Dec 10, 2017
f68ae6a
Add build targets
arianaolson419 Dec 10, 2017
ecbbb45
Implement register + multiplier blocks
arianaolson419 Dec 10, 2017
ad3868a
added a program memory and a controller which runs through program me…
rdiverdi Dec 10, 2017
9804243
fixed merge conflict in makefile
rdiverdi Dec 10, 2017
7412acd
Fix spelling error
arianaolson419 Dec 10, 2017
32a06c7
Implement multiplication
arianaolson419 Dec 10, 2017
0915310
Create multiplexer for multiplication results
arianaolson419 Dec 10, 2017
f018baf
Add build targets
arianaolson419 Dec 10, 2017
64e5c2b
Test network
arianaolson419 Dec 10, 2017
072ba39
Merge branch 'master' of https://github.com/poosomooso/FinalProject
arianaolson419 Dec 10, 2017
f47d703
Add multiplier_network target
arianaolson419 Dec 10, 2017
0105269
merge scripts
poosomooso Dec 11, 2017
e487541
added additional things to fsm that i needed
poosomooso Dec 11, 2017
584f130
update targets
arianaolson419 Dec 11, 2017
4fed898
Add tests
arianaolson419 Dec 11, 2017
a89c581
Merge branch 'master' of https://github.com/poosomooso/FinalProject
arianaolson419 Dec 11, 2017
a928244
Put modules together
arianaolson419 Dec 11, 2017
cf9bf3b
Change module name
arianaolson419 Dec 12, 2017
3694255
change module name
arianaolson419 Dec 12, 2017
9ac55b1
Change module name
arianaolson419 Dec 12, 2017
152b3c4
Change module name
arianaolson419 Dec 12, 2017
2e1317e
Add target for 6by6
arianaolson419 Dec 12, 2017
d5ee09b
Add header comment
arianaolson419 Dec 12, 2017
91d5499
Change module name
arianaolson419 Dec 12, 2017
071012d
Change module name
arianaolson419 Dec 12, 2017
a0e8be4
change module name and fix typo
arianaolson419 Dec 12, 2017
fe67751
Change memory file to write to
arianaolson419 Dec 12, 2017
8d9f578
Create test script for main test
arianaolson419 Dec 12, 2017
cdb259e
Change file to write to
arianaolson419 Dec 12, 2017
9d4393e
write new data
arianaolson419 Dec 12, 2017
246d88e
Make test bench
arianaolson419 Dec 12, 2017
ac2b600
finished matrix manager, but there is a bug in dm
poosomooso Dec 12, 2017
a30ac03
I FOUND IT, not quite all working, but I FOUNT IT
rdiverdi Dec 12, 2017
004f2f6
addressing is now correct
poosomooso Dec 12, 2017
fb7b8d4
fixed bugs with matrix manager; tests pass
poosomooso Dec 12, 2017
20a1d6d
Merge branch 'master' of https://github.com/poosomooso/FinalProject
poosomooso Dec 12, 2017
915ffdc
added writing tests for matrix_manager; updated scripts so they actua…
poosomooso Dec 12, 2017
b365d32
Merge branch 'master' of https://github.com/poosomooso/FinalProject
poosomooso Dec 12, 2017
94e3826
added a useful python script, probably
rdiverdi Dec 11, 2017
0327406
Starting testing
arianaolson419 Dec 12, 2017
d00daa5
Nonblocking equals
arianaolson419 Dec 12, 2017
7bfef07
Update index.md
poosomooso Dec 12, 2017
ba34bf4
added pics
poosomooso Dec 12, 2017
882c47c
Flipped order of writing data
arianaolson419 Dec 12, 2017
d85f6eb
Merge branch 'master' of https://github.com/poosomooso/FinalProject
arianaolson419 Dec 12, 2017
257bda1
got memory to output to a file and added a python script for reading …
rdiverdi Dec 12, 2017
8cee9d8
fucking github pages is the worst
poosomooso Dec 12, 2017
c7192b5
still the worst
poosomooso Dec 12, 2017
97f76bb
Updated loadblock
poosomooso Dec 12, 2017
935c320
Small wording/grammar fixes.
arianaolson419 Dec 12, 2017
54d7c1a
added some text to go with the overall diagram
rdiverdi Dec 12, 2017
62911c5
fixed merge conflict
rdiverdi Dec 12, 2017
ce4cfe6
added a thing about dependencies
poosomooso Dec 12, 2017
d226ddd
hopefully add working link
arianaolson419 Dec 12, 2017
917a450
move to docs
arianaolson419 Dec 12, 2017
c8807fa
add python memory checking script
arianaolson419 Dec 12, 2017
c5d21a3
Merge branch 'master' of https://github.com/poosomooso/FinalProject
arianaolson419 Dec 12, 2017
a1ab4b8
Moved to docs
arianaolson419 Dec 12, 2017
1e3f145
Add section on integration test
arianaolson419 Dec 12, 2017
4f48db1
Remove unnecessary lines
arianaolson419 Dec 12, 2017
07cd74b
added a lot of stuff to the webpage
poosomooso Dec 12, 2017
f9f5eb5
Merge branch 'master' of https://github.com/poosomooso/FinalProject
poosomooso Dec 12, 2017
33f79fe
Merge branch 'master' of https://github.com/poosomooso/FinalProject
arianaolson419 Dec 12, 2017
5788b46
added pics
poosomooso Dec 12, 2017
eb2d6db
Merge branch 'master' of https://github.com/poosomooso/FinalProject
poosomooso Dec 12, 2017
15b69c3
picture formatting that actually works
poosomooso Dec 12, 2017
1a6baee
small formatting things
poosomooso Dec 12, 2017
f612049
Update index.md
poosomooso Dec 12, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Ignore compiled binaries
*
!/**/
!*.*
!makefile
*.out

# Ignore gtkwave files
*.vcd

# Ignore temporary memory file
mem.dat
13 changes: 13 additions & 0 deletions 6by6multiply.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
python2 setup_memory.py

cat data_test.dat > matrix_mem.dat
cat prog_test.dat > prog_mem.dat

echo "Running the BIG test..."
make
./multiplier6by6

python2 read_6by6result.py

make clean
36 changes: 36 additions & 0 deletions ProjectProposal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# GPU Matrix Operations
### Ariana Olson, Rocco DiVerdi, Serena Chen

We want to study GPU architectures, and build a simple one to do matrix operations. We want to understand the strategy for multiplying matrices in the GPU, and how the GPU is programmed to perform these operations. We will also build a small toy matrix multiplier module in verilog, which can be scaled in scope depending on how much time the previous parts of the project take.

## References:

[Understanding the Efficiency of GPU Algorithms for Matrix-Matrix Multiplication](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.1.6823&rep=rep1&type=pdf)

[Matrix computations on the GPU](https://developer.nvidia.com/sites/default/files/akamai/cuda/files/Misc/mygpu.pdf)

[Matrix Multiplication with CUDA — A basic introduction to the CUDA programming model](https://www.shodor.org/media/content/petascale/materials/UPModules/matrixMultiplication/moduleDocument.pdf)

[some random project from somewhere making a GPU](https://courses.cs.washington.edu/courses/cse467/15wi/docs/prj1.pdf)

## MVP:

Present to class about how GPUs perform matrix multiplication and other operations. And how it compares to MIPS CPU.

Planned: Build a toy processor that performs operations and prints results to the terminal.

Stretch: Visualize real time matrix transformations for a small set of “pixels”

Super Stretch: be hired by Nvidia

Even more super stretch: start a GPU company and make Nvidia obsolete

## Work Plan:

Thanksgiving break: sleep

11/27-12/3: Learn about matrix multiplication on GPUs, run some example programs on actual GPUs. Set up documentation framework. Start writing up explanations of what we have learned.

12/4-12/10: Start implementing verilog modules. Create documentation on performance, how to run tests/examples, block diagrams, etc.

12/10-12/14: Debugging, polishing, documenting. (try not to be dead)
61 changes: 61 additions & 0 deletions add3by3.t.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
Test bench for 3 by 3 matrix adder
*/

`include "add3by3.v"

module add3by3_TEST();
parameter ENTRY_SIZE = 9;

reg[ENTRY_SIZE - 1:0] a0, a1, a2, a3, a4;
reg[ENTRY_SIZE - 1:0] a5, a6, a7, a8;
reg[ENTRY_SIZE - 1:0] b0, b1, b2, b3, b4;
reg[ENTRY_SIZE - 1:0] b5, b6, b7, b8;
wire[ENTRY_SIZE - 1:0] c0, c1, c2, c3, c4;
wire[ENTRY_SIZE - 1:0] c5, c6, c7, c8;

add3by3 #(.ENTRY_SIZE(ENTRY_SIZE)) dut (
.a0(a0), .a1(a1), .a2(a2), .a3(a3), .a4(a4),
.a5(a5), .a6(a6), .a7(a7), .a8(a8), .b0(b0),
.b1(b1), .b2(b2), .b3(b3), .b4(b4), .b5(b5),
.b6(b6), .b7(b7), .b8(b8), .c0(c0), .c1(c1),
.c2(c2), .c3(c3), .c4(c4), .c5(c5), .c6(c6),
.c7(c7), .c8(c8)
);

initial begin
// Add two matrices
a0 = 1; a1 = 2; a2 = 3; a3 = 4; a4 = 5; a5 = 6; a6 = 7; a7 = 8; a8 = 9;
b0 = 30; b1 = 29; b2 = 28; b3 = 27; b4 = 26; b5 = 25; b6 = 24; b7 = 23; b8 = 22;

#50

if (c0 !== 5'd31) begin
$display("Test case failed.\nExpected value of c0: %b\tActual value of c0: %b", a0 + b0, c0);
end
if (c1 !== 5'd31) begin
$display("Test case failed.\nExpected value of c1: %b\tActual value of c1: %b", a1 + b1, c1);
end
if (c2 !== 5'd31) begin
$display("Test case failed.\nExpected value of c2: %b\tActual value of c2: %b", a2 + b2, c2);
end
if (c3 !== 5'd31) begin
$display("Test case failed.\nExpected value of c3: %b\tActual value of c3: %b", a3 + b3, c3);
end
if (c4 !== 5'd31) begin
$display("Test case failed.\nExpected value of c4: %b\tActual value of c4: %b", a4 + b4, c4);
end
if (c5 !== 5'd31) begin
$display("Test case failed.\nExpected value of c5: %b\tActual value of c5: %b", a5 + b5, c5);
end
if (c6 !== 5'd31) begin
$display("Test case failed.\nExpected value of c6: %b\tActual value of c6: %b", a6 + b6, c6);
end
if (c7 !== 5'd31) begin
$display("Test case failed.\nExpected value of c7: %b\tActual value of c7: %b", a7 + b7, c7);
end
if (c8 !== 5'd31) begin
$display("Test case failed.\nExpected value of c8: %b\tActual value of c8: %b", a8 + b8, c8);
end
end
endmodule
41 changes: 41 additions & 0 deletions add3by3.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
Add two 3 by 3 matrix blocks.
Performs the operation A + B = C

Entries 0 to 8
of all matrices are arranged in the following order:

x0 x1 x2
x3 x4 x5
x6 x7 x8

Inputs:
- a0, ..., a8: the entries of matrix A
- b0, ..., a8: the entries of matrix B
Outputs:
- c0, ..., c8: the entries of matrix C
Parameters:
- ENTRY_SIZE: the number of bits of each matrix entry
*/

module add3by3
#(
parameter ENTRY_SIZE = 5
)(
input[ENTRY_SIZE - 1:0] a0, a1, a2, a3,
input[ENTRY_SIZE - 1:0] a4, a5, a6, a7, a8,
input[ENTRY_SIZE - 1:0] b0, b1, b2, b3,
input[ENTRY_SIZE - 1:0] b4, b5, b6, b7, b8,
output[ENTRY_SIZE - 1:0] c0, c1, c2, c3,
output[ENTRY_SIZE - 1:0] c4, c5, c6, c7, c8
);
assign c0 = a0 + b0;
assign c1 = a1 + b1;
assign c2 = a2 + b2;
assign c3 = a3 + b3;
assign c4 = a4 + b4;
assign c5 = a5 + b5;
assign c6 = a6 + b6;
assign c7 = a7 + b7;
assign c8 = a8 + b8;
endmodule
42 changes: 42 additions & 0 deletions arithmetic.t.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
Test bench for the scalar multiplication module
*/

`include "arithmetic.v"
module scalar_multiplication_TEST();

parameter ENTRY_SIZE = 5;
parameter RESENTRY_SIZE = 9;

reg[ENTRY_SIZE - 1:0] a, b;
wire[RESENTRY_SIZE - 1:0] out;

scalar_multiplication #(.ENTRY_SIZE(ENTRY_SIZE), .RESENTRY_SIZE(RESENTRY_SIZE)) dut (a, b, out);

initial begin
// Multiply by 0
a = 5'd0; b = 5'd0; #50
if (out !== 9'd0) begin
$display("Test failed. Expected output: %b. Actual output: %b", 9'd0, out);
end

// Multiply by 1
a = 5'd1; b = 5'd15; #50
if (out !== 9'd15) begin
$display("Test failed. Expected output: %b. Actual output: %b", 9'd15, out);
end

// Multiply two numbers that do not overflow the result size
a = 5'd25; b = 5'd20; #50
if (out !== 9'd500) begin
$display("Test failed. Expected output: %b. Actual output: %b", 9'd500, out);
end

// Multiply two numbers that overflow the result size
// Expect the most significant bits to be truncated
a = 5'd31; b = 5'd25; #50
if (out !== 9'd263) begin
$display("Test failed. Expected output: %b. Actual output: %b", 9'd263, out);
end
end
endmodule // testMult
24 changes: 24 additions & 0 deletions arithmetic.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
Performs a scalar multiplication on two numbers.
Represents the operation a * b = c.
Inputs:
- a and b are the two scalars being multiplied
Outputs:
- result is the scalar product.
Parameters:
- ENTRY_SIZE is the size of a and b
- RESENTRY_SIZE is the size of result
*/
module scalar_multiplication
#(
parameter ENTRY_SIZE = 5,
parameter RESENTRY_SIZE = 9
)
(
input [ENTRY_SIZE - 1:0] a, b,
output [RESENTRY_SIZE - 1:0] result
);

assign result = a*b;

endmodule // multiplication
73 changes: 73 additions & 0 deletions block_test_data.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
// This is the memory that should be used in the load block test

// 3 by 3 identity at address 0
0_0001
0_0000
0_0000
0_0000
0_0001
0_0000
0_0000
0_0000
0_0001

// 4 by 4 increasing at address 9
0_0000
0_0001
0_0010
0_0011
0_0100
0_0101
0_0110
0_0111
0_1000
0_1001
0_1010
0_1011
0_1100
0_1101
0_1110
0_1111

// 7 by 3 decreasing at address 25
1_1111
1_1110
1_1101
1_1100
1_1011
1_1010
1_1001
1_1000
1_0111
1_0110
1_0101
1_0100
1_0011
1_0010
1_0001
1_0000
0_1111
0_1110
0_1101
0_1100
0_1011

// Extra memory at address 46
0_0000
0_0000
0_0000
0_0000
0_0000
0_0000
0_0000
0_0000
0_0000
0_0000
0_0000
0_0000
0_0000
0_0000
0_0000
0_0000
0_0000
0_0000
Loading