Code Monkey home page Code Monkey logo

ann-vhdl's Introduction

A HARDWARE IMPLEMENTATION OF ARTIFICIAL NEURAL NETWORKS FOR INFERENCE

The growing investment in the use of artificial neural networks for end-user services, which require low latency and high responsiveness, make it desirable to have dedicated hardware accelerators for inference. FPGA (Field-Programmable Gate Arrays) programmable devices have the required ideal flexibility for the deployment of artificial neural network accelerators, while being able to support different architectural network models and still keeping performance. A modular artificial neural network design is developed in hardware description language in order to allow inference from reconfigurable devices with desirable performance. The modular design enables it to be easily scaled to support new neural network architectures and different activation functions. The project’s validation is verified by a hardware implementation of a simple and widely known neural network (exclusive-OR (XOR) function).

Implementation

The VHDL code was developed in a modular fashion, allowing different activation functions and mixing of different neuron approaches (e.g. behavioral, structural, area or speed optimizations etc). The same modularity is observed in artifical neural networks, so that developing on this same fashion becomes intuitive. Developing and adding different activation functions or neural architectures thus becomes trivial.

The code uses the following hierarchical organization, from lowest to highest level:

types.vhd

Integer and fractional bit size configuration for the components (defaults to Q16.16). Some other functions for easier conversion and value setting in VHDL. Mainly responsible for setting the desired network precision (compromise between performance and precision);

act_func.vhd

Activation functions implementation. Other activation functions or reimplementation of existing activation function must be implemented in this file through an architecture;

neuron.vhd

Artificial neuron implementation. New neuron descriptions must be implemented in this file through an architecture. Neurons use an activation function described in act_func.vhd. Thus, it is possible to mix different activation functions on the same neural network, as needed;

network.vhd

Implementation of the network and its interconnections. This is where the neurons are instantiated and positioned on the network, as needed in the architecture. Different architectures can be implemented. The inputs of the network are directly connected to the input neurons. The network is controlled through the neuron connections of the hidden layer.

Remarks

Further work is needed to address a few issues:

  • Routing becomes non-trivial for wider networks and can be difficult;
  • More complex activation functions need to be implemented;
  • Better documentation is needed;
  • An automated way of converting high-level code to its VHDL equivalent should be made (perhaps using ONNX as an intermediate representation);
  • More testing is needed.
gabrieljcs [at] protonmail [dot] com

ann-vhdl's People

Contributors

gabrieljcs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

ann-vhdl's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.