Computing "mod" using embedded MATLAB

버전 1.0.0.1 (10.3 KB) 작성자: Kiran Kintali
This demo shows how to use embedded MATLAB to compute mod3 of a number in a hardware friendly fashio
다운로드 수: 10.1K
업데이트 날짜: 2016/9/1

라이선스 보기

Hardware design and implementation of an algorithm is all about finding alternatives to achieve some design goals like higher performance, low area or low power etc.,
Often when designing hardware algorithms one would stumble upon an expensive operation like division or modulo and would be hard pressed to replace it with a low cost alternative like repeated subtraction to meet the design goals.

Consider (m mod n) operation as shown below

(m mod n) = (m - (n * floor(m/n))

In the above expression division operator consumes lots of FPGA resources and creates long critical paths reducing performance of the algorithm.

This demo shows how to compute modulo of in a hardware friendly fashion by avoiding expensive division. It shows how to compute mod3 of a 32 bit number as a tree of mod3 operations on a 4bit numbers which can be implemented as an inexpensive multiplexer.

This algorithm breaks the binary number (m) into equal number of chunks and computes modulo(n) on the smaller chunks, concatenates the resultant values and repeats;

This algorithm uses bitslice and bitconcat functions to extract smaller chunks (nibbles in this case) and a simple switch to calculate the mod3 of a 4bit slice;

인용 양식

Kiran Kintali (2024). Computing "mod" using embedded MATLAB (https://www.mathworks.com/matlabcentral/fileexchange/18727-computing-mod-using-embedded-matlab), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2007b
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
버전 게시됨 릴리스 정보
1.0.0.1

Updated license

1.0.0.0

add to eML category