Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use unsigned for non-negative numeric vectors, signed for two’s-complement values, and std_logic_vector for uninterpreted bit collections. Both arithmetic types come from IEEE numeric_std; a std_logic_vector does not become numeric merely because that package is imported.

This distinction controls interpretation, comparisons, extension, overflow, and whether an expression compiles. The examples below use portable VHDL style and show where explicit conversion or widening is required.

The three vector types

Type Meaning Typical use
std_logic_vector No inherent numeric meaning Raw buses, packed protocol fields, compatibility interfaces
unsigned Non-negative binary integer Counters, addresses, lengths, masks
signed Two’s-complement integer Offsets, differences, coefficients, signed samples

VHDL is strongly typed: signedness is part of the type, not a property inferred from the most-significant bit. A signal cannot be both types without an explicit conversion. The IEEE package declaration defines SIGNED and UNSIGNED as arrays of STD_LOGIC, with the leftmost element as the most-significant bit (IEEE numeric_std declaration).

Representation and ranges

UNSIGNED

An unsigned(N-1 downto 0) value is the sum of each bit multiplied by its power of two. An 8-bit value ranges from 0 through 255: "00000101" is 5 and "11111111" is 255.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

SIGNED

signed uses two’s complement. An N-bit value ranges from -2**(N-1) through 2**(N-1)-1; 8 bits therefore represent −128 through +127. The same pattern "11111111" is 255 as unsigned but −1 as signed. Representation details are documented in the numeric_std package body.

Use numeric_std as the arithmetic baseline

library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;

The package supplies arithmetic, comparisons, multiplication, division, conversion functions, and resize for signed and unsigned vectors (package declarations). Avoid importing std_logic_arith, std_logic_unsigned, or std_logic_signed into new code: legacy Synopsys packages may be needed for old projects, but competing overloads commonly cause ambiguity. AMD lists both legacy compatibility packages and IEEE numeric_std separately in its Vivado 2026.1 synthesis documentation.

Conversions: reinterpretation versus resizing

Between vectors

u_value <= unsigned(slv_value);
s_value <= signed(slv_value);
slv_value <= std_logic_vector(u_value);

These conversions preserve the bit pattern and change its language-level interpretation (or expose it as a general-purpose vector). They do not change width. For example, bits "11111111" become 255 when converted to unsigned and −1 when converted to signed.

Between integers and vectors

u_value <= to_unsigned(integer_value, u_value'length);
s_value <= to_signed(integer_value, s_value'length);
integer_value <= to_integer(u_value);
integer_value <= to_integer(s_value);

to_unsigned requires a non-negative integer and an explicit width; to_signed takes an integer and width. to_integer(unsigned) returns a NATURAL, while the signed overload returns an INTEGER. Integer ranges are finite and implementation-dependent, so these conversions are often best kept to control logic or testbenches rather than large datapaths.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

Changing width with resize

wide_u <= resize(narrow_u, wide_u'length);
wide_s <= resize(narrow_s, wide_s'length);

Widening an unsigned value adds zeroes; widening a signed value sign-extends by copying its sign bit. Narrowing discards upper bits and can lose information. A cast such as signed(bus) does not perform this width change.

Arithmetic and result widths

Carry-preserving addition

For addition and subtraction, numeric_std operators generally return the larger operand width; they do not automatically create a carry bit for an equal-width destination. Widen before the operation:

signal a, b   : unsigned(7 downto 0);
signal sum9   : unsigned(8 downto 0);
sum9 <= resize(a, sum9'length) + resize(b, sum9'length);

The same rule applies to signed values:

signal x, y       : signed(7 downto 0);
signal sum_ext    : signed(8 downto 0);
sum_ext <= resize(x, sum_ext'length) + resize(y, sum_ext'length);

Multiplication and accumulation

A full product commonly needs the sum of operand widths:

signal a, b   : unsigned(7 downto 0);
signal product : unsigned(15 downto 0);
product <= a * b;

For accumulators, choose a destination width that covers the required mathematical range, widen every operand to that width, and document whether eventual truncation is intentional.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.

Wrap, truncate, flag, or saturate

Fixed-width arithmetic does not automatically saturate. Assignment to a narrower vector discards bits; modulo wrap may be correct for a counter but wrong for a sensor or audio path. Saturation and overflow flags must be coded explicitly, for example by comparing a widened sum with a limit before assigning the final width.

Mixed signedness, comparisons, and literals

Keep one arithmetic domain

Do not rely on implicit conversion between signed and unsigned. First decide what the bits mean, then convert and resize into a common width:

result <= resize(a, result'length)
        + signed(resize(b, result'length));

This is valid only if b’s bit pattern is intentionally being interpreted as signed. If it is a non-negative magnitude, redesign the expression around an appropriate common representation instead.

Comparisons

Relational operators use the operand type’s interpretation. The pattern "11111111" compares as 255 in an unsigned expression and −1 in a signed expression. Convert both operands deliberately before comparing values from different domains.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

Literals

  • 5 is an integer literal; contextual overload resolution often makes count + 1 clear.
  • x"05" is a based bit-pattern literal whose type still needs context.
  • "00000101" is a string literal, not automatically numeric.
  • to_unsigned(5, count'length) and to_signed(-3, offset'length) state width and interpretation explicitly.
  • A qualified expression such as unsigned'(x"F0") supplies the required type context.

Complete coding patterns

Unsigned counter

library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;

entity counter is
  port (clk : in std_logic; reset : in std_logic; q : out unsigned(7 downto 0));
end entity;

architecture rtl of counter is
  signal count : unsigned(7 downto 0);
begin
  process(clk)
  begin
    if rising_edge(clk) then
      if reset = '1' then
        count <= (others => '0');
      else
        count <= count + 1;
      end if;
    end if;
  end process;
  q <= count;
end architecture;

Raw bus at an interface

signal data_bus : std_logic_vector(15 downto 0);
signal sample   : signed(15 downto 0);
sample   <= signed(data_bus);
data_bus <= std_logic_vector(sample);

Array direction and ports

Descending ranges such as unsigned(7 downto 0) are conventional. Ascending ranges are legal, but consistency matters: vector(0) is not universally the least-significant bit, and conversions do not normalize every range assumption. Check directions when connecting records, arrays, and positional port associations.

Use numeric types directly on ports when the interface is conceptually numeric and the surrounding design supports them. Keep std_logic_vector for raw protocols, fields with multiple interpretations, or compatibility boundaries; convert once at that boundary rather than casting throughout internal arithmetic.

Unknown values and verification

Because these types contain STD_LOGIC, simulation can include 'U', 'X', 'W', 'Z', and '-'. Uninitialized operands can propagate unknowns, and to_integer on invalid bits can warn or fail to yield a meaningful value. Do not conceal initialization bugs by converting everything to integers. Assert reset, range, sign, and width assumptions; where supported by the simulator, an assertion such as assert not is_x(std_logic_vector(count)) can detect unknown values. Verify the exact is_x availability in the imported logic package and tool.

Common errors and fixes

Symptom Likely cause Fix
std_logic_vector + integer fails The vector has no numeric meaning Convert to unsigned/signed, preferably keeping the internal signal numeric
Eight-bit sum loses carry Operands were not widened resize both operands before addition
11111111 becomes −1 It was interpreted as signed Choose the intended domain explicitly
Negative value becomes a large positive Zero-extension or unsigned conversion was used Sign-extend with resize(signed_value, wider_length)
Operator is ambiguous Conflicting packages, mixed types, or an under-specified literal Remove legacy imports, qualify literals, and use typed intermediates
Simulation shows warnings or X values Missing reset or unknown stimulus Inspect waveforms, initialize/reset signals, and add assertions
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Alternatives and tool support

numeric_bit offers similar arithmetic using BIT rather than multi-valued STD_LOGIC. VHDL-2008 packages such as numeric_std_unsigned can provide unsigned-style operations on std_logic_vector, but availability depends on the language mode and tool; consult the IEEE 2008 source. For fractional hardware, IEEE fixed_pkg is often clearer than hand-managed scaling; AMD lists it and float_pkg among supported packages.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

GHDL defaults to VHDL-93 unless another standard is selected, and its compatibility options are documented at GHDL invocation documentation. VHDL-2019 is an active IEEE standard (IEEE 1076-2019), but feature support remains tool- and version-dependent; check AMD or Intel matrices, including Intel’s VHDL-2019 support page.

Which simulator or FPGA suite do you need?

  • GHDL: free and suitable for learning, command-line simulation, CI, and regression tests; it does not replace vendor synthesis, timing, IP, or programming flows.
  • AMD Vivado: appropriate when targeting AMD/Xilinx devices. Its 2026.1 licensing page lists BASIC at $0 with annual renewal, paid CORE and PRO subscriptions, and perpetual ENTERPRISE and GOLD tiers; prices and device eligibility are time-sensitive (official pricing).
  • Intel Quartus Prime Lite: a free download with no license file required for supported device families (edition overview).
  • Questa Intel FPGA Starter Edition: free but requires a zero-cost license (Intel licensing FAQ).

You do not need a commercial simulator merely to learn signed and unsigned conversions. Start with GHDL; move to Vivado or Quartus when the target FPGA and vendor workflow require it.

Frequently Asked Questions

Is std_logic_vector unsigned in VHDL?

No. It is a collection of logic values with no inherent numeric interpretation. Convert it explicitly to unsigned or signed before arithmetic.

Does VHDL addition automatically keep a carry bit?

Not generally. Widen both operands with resize before addition when the carry must be preserved.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Should new projects use Synopsys arithmetic packages?

Prefer IEEE numeric_std for new portable code. Legacy packages remain useful when maintaining existing designs but can create overload conflicts.

The Bottom Line

Choose the type from the value’s meaning, keep arithmetic in one signedness domain, widen before operations whose full range matters, and convert only at deliberate interfaces.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.