In VHDL, what is strongly typed means?

  • Thread starter Thread starter dexterdev
  • Start date Start date
  • Tags Tags
    Means
Click For Summary

Discussion Overview

The discussion centers around the concept of strong typing in VHDL, exploring what it means for a programming language to be strongly typed, particularly in relation to data type constraints and error handling during compilation. The scope includes theoretical explanations and comparisons with other programming languages.

Discussion Character

  • Technical explanation
  • Conceptual clarification
  • Debate/contested

Main Points Raised

  • Some participants explain that strongly typed languages enforce strict constraints on how different data types can be mixed and what operations can be performed, resulting in compile errors for incompatible types.
  • One participant contrasts strongly typed languages with loosely typed languages, providing examples of how operations on incompatible types are handled differently, such as in JavaScript.
  • Another participant emphasizes that in VHDL, every variable and data type must be explicitly declared, and conversions require explicit functions, which enhances code reliability and organization.
  • A humorous remark suggests a misunderstanding of the term "strongly typed" as referring to the use of all capital letters.

Areas of Agreement / Disagreement

Participants generally agree on the characteristics of strong typing in VHDL, but there are varying interpretations and examples provided, indicating that the discussion remains somewhat open-ended.

Contextual Notes

Some limitations include the potential for differing interpretations of what constitutes strong typing and the absence of consensus on the implications of strong versus weak typing across different programming languages.

Who May Find This Useful

This discussion may be useful for individuals interested in programming languages, particularly those working with VHDL or comparing it to other languages like Verilog and JavaScript.

dexterdev
Messages
194
Reaction score
1
In VHDL, what is strongly typed means? ie like VHDL is a strongly typed language etc

-Devanand T
 
Engineering news on Phys.org
Strongly typed means that the compiler enforces lots of constraints on how different data types can be intermixed and what operations can be performed on them. Compile errors are produced if an attempt is made to mix incompatible data types, or perform operations on improper data types. In contrast, loosely coupled means that one is free to mix data types and the programmer is responsible for knowing how the compiler will interpret the resulting operation.

Here is a rather extreme example: what happens if I attempt to perform the operation of multiplication on two character string data types? A strongly typed language will produce an error, after all it makes no sense to multiply character strings right?

On the other hand, a loosely typed language may go ahead and multiply them according to some predetermined rule that the programmer is expected to be aware of. JavaScript can be considered loosely typed in this respect. "12"x"12" will produce the character string "144" while "12"+"12" produces "1212" since + happens to be the concatenation operator for strings.

Back to VHDL: same idea. I cannot assign a 4-bit variable to an 8-bit register. They are considered incompatible and a compile error will result. Verilog, which is weakly typed, will make the assignment and we developers are fully aware of how the 4-bits will get mapped to the 8-bit register. Same the other way around. If I assign an 8-bit variable to a 4-bit register, Verilog developers know which 4 bits are getting truncated. VHDL programmers will get a compile error.
 
Last edited:
Haha -- I THOUGHT IT MEANT ALL CAPS!
 
.

Strongly typed means that every variable and data type in VHDL must be explicitly declared and cannot be changed or converted without explicit conversion functions. This ensures that the code is more reliable and less prone to errors, as the compiler will catch any type mismatches or inconsistencies. It also allows for better organization and structure of code, making it easier to read and maintain. Overall, this feature of VHDL promotes good coding practices and helps to ensure the accuracy and reliability of the design.
 

Similar threads

  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 6 ·
Replies
6
Views
3K
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 4 ·
Replies
4
Views
10K
Replies
8
Views
5K
Replies
2
Views
2K