Switch branches/tags
Nothing to show
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
..
Failed to load latest commit information.
src_c
src_common
src_tb
src_v01
src_v02
.gitignore
DotProduct.bspec
Makefile
README

README

------------------------------------
Designing a dot-product compute core
------------------------------------

This directory contains the programming assignment to design a block which
computes the dot product of two vectors

For instance, given two vectors of equal length (in this example, the length is
three):

A = (a; b; c)

W = (x; y; z)

Y = A . W = (ax+by+cz)

The module will be pre-loaded with the Weights Vector, W. For the sake of this
example, assume that:

W = (1, 2, 3, 4, 5, 6, 7, 8) and is hard-coded into your module.

The module receives a streaming input of A vectors

For the sake of this exercise assume that it's an endless stream. The module
computes the scalar dot product for each A, and drives out the result.

Since the W vector is 8-wide, each row of A is also 8-wide.

v01
---
In this version of the design there is a single MAC (multiply-accumulate)
resource. So, the block will take multiple cycles to compute the output for
each row. This is an iterative implementation.


    ---------------------------------
 W  |   |   |   |   |   |   |   |   |-----
    ---------------------------------    |
                                       -----
                                       |MAC|
                                       -----
    ---------------------------------    |
 A  |   |   |   |   |   |   |   |   |-----
    ---------------------------------

A and W are shift registers, with the LSB shifted into the MSB location after
each MAC operation. Once all eight shifts are complete, generate the output

MAC Operation: m <= m + (w*a);

v02
---
In this version of the design there are as many multiply-accumulate resources
as the width of W and A. The block should be able to generate an output 
every cycle. This is a parallel implementation.

------------------------------------------------------------------------
Assignment
----------

Your assignment is to first create the v01 implementation, and verify that it
is working correctly by running it on the test-bench. The test-bench has logic
to check the results.

On successful completion of v01, please be ready to explain how your logic
works.

Finally, you will also be expected to complete the v02 version as well.
For v02 you will have to prove how it is a faster implementation.

------------------------------------------------------------------------
Tips
----
Use $display statements to understand what's going on in the code. In general
displays are more useful than waveforms, at least in the beginning

Get used to searching through the reference guide:
    $BLUESPECDIR/../doc/BSV/bsv-reference-guide.pdf

Get familiar with the Vector library, it will prove very useful. There is a
chapter on Vectors in the reference guide.

------------------------------------------------------------------------
Guidelines
----------

Comment your code. As a rule of thumb, there should be a line of comment for
each line of logic in your code.

Place your code in the src_v01 or src_v02 directory, depending on the section
you are working on. Make all your edits in the BSV files already placed in the
directories.

Compile your code often. To compile: make

To simulate the design: ./out

To dump waveforms: ./out -V
You will need a viewer like gtkwave to view the waveforms

------------------------------------------------------------------------
Directory Structure
-------------------

src_c      - c routines to check the computation
src_tb     - BSV testbench
src_common - type definitions and utility functions for both implementation
             versions
src_v01    - your code to implement v01
src_v02    - your code to implement v02
build      - location for the files generated during compile