fpga:vhdl
This is an old revision of the document!
Table of Contents
VHDL
opencores – Mostly verilog? Might find something useful
Things is should write down
- Math-functions for determining bit width (IEEE.math_real.all)
- Generic notation
- natural and conversion to integer and real
- Defining functions
- Entity instantiation Stack overflow
- State machines using type
- Some simulation specific stuff like after 3ps and assert
- High impedance value of std_logic ('Z')
Conversions
library ieee; use ieee.std_logic_1164.all; -- std_logic_vector use ieee.numeric_std.all; -- signed and unsigned -- numbers, math operations allowed signal my_int : integer; -- 32 bit 2-complement signal my_uint : unsigned (7 downto 0); signal my_sint : signed (7 downto 0); -- loose bits, math operations not allowed signal my_bits : std_logic_vector (7 downto 0); -- conversions between integers my_uint <= to_unsigned(my_int, 8); -- Must specify bit length my_sint <= to_signed(my_int, 8); my_int <= to_integer(my_uint); my_int <= to_integer(my_sint); -- casts between binary representations, number of bits must match my_uint <= unsigned(my_sint); my_uint <= unsigned(my_bits); my_sint <= signed(my_uint); my_sint <= signed(my_bits); my_bits <= std_logic_vector(my_uint); my_bits <= std_logic_vector(my_sint);
-- Char to unsigned tx_char <= to_unsigned(character'pos('a'), 8);
fpga/vhdl.1744469075.txt.gz · Last modified: 2025/04/12 14:44 by utedass
