ArticleslgStudy

science

Numeric std

Numeric std is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Numeric std rather than just read about it. In short: numeric_std is a library package defined for VHDL. It provides arithmetic functions for vectors.

Key takeaways

  • Numeric std belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Numeric std to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Numeric std from memory before moving on to harder problems.

Reference excerpt

numeric_std is a library package defined for VHDL. It provides arithmetic functions for vectors. Overrides of std_logic_vector are defined for signed and unsigned arithmetic. It defines numeric types and arithmetic functions for use with synthesis tools. Two numeric types are defined: UNSIGNED (represents UNSIGNED number in vector form) and SIGNED (represents a SIGNED number in vector form). The base element type is type STD_LOGIC. The leftmost bit is treated as the most significant bit. Signed vectors are represented in two's complement form. This package contains overloaded arithmetic operators on the SIGNED and UNSIGNED types. The package also contains useful type conversions functions. It is typically included at the top of a design unit:

The alternative numeric package ieee.std_logic_arith should not be used for new designs. This package does not provide overrides for mixing signed and unsigned functions. This package includes definitions for the following (not all of which are synthesizable):

Operators and functions

Sign changing operators abs -

Arithmetic operators + - * / rem mod Note: the second argument of /, rem, or mod must be nonzero.

Comparison operators > < <= >= = /=

Shift and rotate functions SHIFT_LEFT SHIFT_RIGHT ROTATE_LEFT ROTATE_RIGHT sll srl rol ror

Resize function RESIZE(v,n) Note: when increasing the size of a signed vector the leftmost bits are filled with the sign bit, while truncation retains the sign bit along with the (n-1) rightmost bits. For an unsigned vector, a size increase fills the leftmost bits with zero, while truncation retains n rightmost bits.

Conversion functions TO_INTEGER TO_UNSIGNED TO_SIGNED Note: The latter two functions each require a second argument specifying the length of the resulting vector.

Logical operators not and or nand nor xor xnor

Match function STD_MATCH Note: compares argument vectors element by element, but treats any bit with the value '-' as matching any other STD_ULOGIC value. Returns false if any argument bit is 'U', 'X', 'W', or 'Z'.

Special translation function TO_01 Note: 'H' is translated to '1' and 'L' is translated to '0'; this function takes an optional second argument XMAP, which can be any of the std_logic values, but defaults to '0'. Any value besides 01LH in the input argument results in all bits being set to XMAP, with a warning issued.

References

Worked examples

Example 1 — a first encounter with Numeric std

Start with the simplest possible case. Write down what Numeric std claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Numeric std before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Numeric std ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Numeric std

In research
Numeric std appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Numeric std in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Numeric std is common in secondary-school and first-year university syllabi. It links to neighbouring topics Hardware description languages, so understanding it makes those chapters shorter.
In everyday life
Look for Numeric std outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Numeric std in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Numeric std means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Numeric std out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Numeric std in simple terms?

numeric_std is a library package defined for VHDL. It provides arithmetic functions for vectors.

Why does Numeric std matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Numeric std?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Numeric std.

Tags

  • Hardware description languages

Keep exploring