Comments (2)
Subtypes are not distinct for the purposes of overload resolution. See section 4.5.1 of the 2008 LRM:
Two formal parameter lists are said to have the same parameter type profile if and only if they have the same number of parameters, and if at each parameter position the corresponding parameters have the same base type.
The error above then follows from the visibility rules in section 12.3:
Each of two declarations is said to be a homograph of the other if and only if both declarations have the same designator, and they denote different named entities, and either overloading is allowed for at most one of the two, or overloading is allowed for both declarations and they have the same parameter and result type profile (see 4.5.1).
So the two functions above are homographs since they have the same designator (has_rd
), the parameter base types are the same (bit_vector
), and the return type is the same. Then:
Two declarations that occur immediately within the same declarative region, [..], shall not be homographs, unless exactly one of them is the implicit declaration of a predefined operation or is an implicit alias of such an implicit declaration.
The error message could probably be improved a bit though.
For your example to work you need to make instruction32_t
and opcode32_t
separate types rather than subtypes. Something like:
type instruction32_t is array (31 downto 0) of bit;
type opcode32_t is array (6 downto 0) of bit;
function has_rd(op : opcode32_t) return boolean;
function has_rd(ins : instruction32_t) return boolean;
FWIW ModelSim gives a very similar error:
** Error: test.vhd(6): (vcom-1295) Function "has_rd" has already been defined in this region.
** =====> Prior declaration of "has_rd" is at test.vhd(5).
** Note: test.vhd(7): VHDL Compiler exiting
from nvc.
It now reports this:
** Error: homograph of HAS_RD [INSTRUCTION32_T return BOOLEAN] already declared in this region
> test.vhd:6
|
5 | function has_rd(op : opcode32_t) return boolean;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ previous declaration was here
6 | function has_rd(ins : instruction32_t) return boolean;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ duplicate declaration
|
= Note: only the base type is considered when determining if two overloads have the same
parameter type profile
from nvc.
Related Issues (20)
- 2008: Entity passed package type resolution on ports
- Procedure definition inside a process declarative part causes an assertion failure during elaboration HOT 1
- 2008: Cannot lower type kind T_GENERIC HOT 3
- Add error message when attempting to use external signals in procedure prior to elaboration HOT 1
- Segfault with cyclic signal assignments HOT 1
- False error for generic initialised with non globally static expression HOT 2
- JIT throwing illegal instructions HOT 7
- VHDL: Compile error while assigning attributes to "all" signals.
- "Empty basic block" crash while compiling HOT 2
- COCOTB : Unable to acess VHDL packages. HOT 1
- Error when using function signature in report statement HOT 1
- Package Alias
- nvc error creating instance of generic package given a constant as parameter HOT 6
- Boolean typed signals written as 1 bit vectors on the FST output HOT 2
- 8.2 ms not equal to 8200 us
- External name in call to falling_edge is not considered as a name denoting a signal
- Waveforms available when UVVM-based testbench is simulated by nvc vs. ghdl HOT 1
- Case expression with for loop variable HOT 3
- nvc elaboration error when enabling branch coverage HOT 3
- Fatal error when running simulation with PSL and FST export
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nvc.