Coder Social home page Coder Social logo

stdexpert's Introduction

std_logic_expert

Description

A numeric_std compatible replacement for std_logic_arith and std_logic_unsigned.

ALL STD_LOGIC_VECTORS are considered UNSIGNED. If SIGNED operation is needed, due to very specific and INTENDED behavior, it should be used the SIGNED type on NUMERIC_STD.

Types and Typecasts

Types

RANGE_T: record that includes "low" and "high" fields. Used to expand the ranges on VHDL.

USE:

signal|variable myrange : range_t := ( high => <integer>, low => <integer> );

STD_LOGIC_ARRAY: An unconstrained array of unconstrained std_logic_vector. Some tools take a problem with it.

USE:

signal|variable myarray : std_logic_array(y downto 0)(x downto 0) := ( 0 => <vector0>, 1 => <vector1>, others => <vector> );

Type CASTs

Function Input Types
TO_INTEGER(input) STD_LOGIC_VECTOR
TO_STD_LOGIC_VECTOR(input) INTEGER,SIGNED,UNSIGEND
TO_UNSIGNED(input) STD_LOGIC_VECTOR,SIGNED
TO_SIGNED(input) UNSIGNED

Operators

It covers following operators:

Operator LEFT RIGHT RESULT Description
+ , - , * , / STD_LOGIC_VECTOR STD_LOGIC_VECTOR, INTEGER, UNSIGNED STD_LOGIC_VECTOR Arithmetic operator
INTEGER STD_LOGIC_VECTOR STD_LOGIC_VECTOR
UNSIGNED STD_LOGIC_VECTOR STD_LOGIC_VECTOR
> , < , >= , <= , = , /= STD_LOGIC_VECTOR INTEGER BOOLEAN Comparator operator
INTEGER STD_LOGIC_VECTOR BOOLEAN
rol , ror STD_LOGIC_VECTOR STD_LOGIC_VECTOR STD_LOGIC_VECTOR Rotation, getting the bit and placing back to begining.

Functions

Function Use Description
size_of size_of(number,) Return the minimum number of bits that an integer requires to be represented. If a word size is provided, the minimum number of words to represent that number.
index_of index_of(vector) Return the relative position of that register inside a larger register. (i.e. for byte, the byte number of that slice)
rebase rebase(vector) Returns an std_logic_vector starting with 0 and little endian.
range_of range_of(vector) Returns a range_t containing vector'high and vector'low
get_slice get_slice(vector,word_size,index) Returns a smaller vector (size of word_size) a portion of input vector corresponding to a word number (example: byte0 is 7..0, byte1 is 15..8)
set_slice set_slice(vector,word,index) Retruns a vector replacing a portion of vector corresponding to a word number (example: byte0 is 7..0, byte1 is 15..8). Works best ir size_of(vector) is a multiple of size_of(word)
to_range to_range(vector) Returns a range_t containing vector'high and vector'low
index_of_1 index_of_1(vector) Returns the index of highest '1' bit.
index_of_0 index_of_0(vector) Returns the index of highest '0' bit.
all_1 all_1(input) Returns an "all ones" vector sized input-1 downto 0
all_0 all_0(input) Returns an "all zeroes" vector sized input-1 downto 0

stdexpert's People

Contributors

rftafas avatar

Stargazers

Guilherme Paulino avatar

Watchers

 avatar  avatar

Forkers

lrotava

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.