- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I created a file named user_defs.vhl, the contents as below:
LIBRARY ieee; USE ieee.std_logic_1164.all; PACKAGE user_defs IS Type Clock is (int, ext); Type Trig is (manual, auto); function spi_adc_wr_rd(input_dat: bit_vector(15 downto 0); input_clk: std_logic) return bit_vector(15 downto 0); END user_defs; PACKAGE BODY user_defs IS Function SPI_ADC_wr_RD(Input_dat: bit_vector(15 downto 0); Input_clk: std_LOGIC) return bit_vector(15 downto 0) is variable tmp: bit_vector(Input_dat'rang); begin tmp <= Input_dat; return tmp; end; END user_defs; I want to invole this function of SPI_ADC_wr_RD in another VHDL file, ... USE work.user_defs.all ... but when I compile this project, it always displays error as below, even I do not invole this function. 10479 VHDL error at user_defs(9): indexed name type is used but not declared. I am using 32-bit Quartus 13.1, please give me support. thanks! Br jjl3Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is that the full code? it has a typo in it:
you need input_dat'range not rang Also, what are you expecting this function to do? currently. it does nothing except return the input. And the clock parameter does nothing.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Apart from the typo (rang -> range) and also tmp being assigned as a signal rather than a variable, the source of the error message given by Quartus is probably that you define the return type as a bit_vector(15 downto 0). This is interpreted as an array of bit_vectors (thus the mentioning of indexed name type). If you remove (15 downto 0) from the return clauses this compilation error should be cleared. That is: ... Function SPI_ADC_wr_RD(Input_dat: bit_vector(15 downto 0); Input_clk: std_LOGIC) return bit_vector; END user_defs; PACKAGE BODY user_defs IS Function SPI_ADC_wr_RD(Input_dat: bit_vector(15 downto 0); Input_clk: std_LOGIC) return bit_vector is ... /J- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- Hi, Apart from the typo (rang -> range) and also tmp being assigned as a signal rather than a variable, the source of the error message given by Quartus is probably that you define the return type as a bit_vector(15 downto 0). This is interpreted as an array of bit_vectors (thus the mentioning of indexed name type). If you remove (15 downto 0) from the return clauses this compilation error should be cleared. That is: ... Function SPI_ADC_wr_RD(Input_dat: bit_vector(15 downto 0); Input_clk: std_LOGIC) return bit_vector; END user_defs; PACKAGE BODY user_defs IS Function SPI_ADC_wr_RD(Input_dat: bit_vector(15 downto 0); Input_clk: std_LOGIC) return bit_vector is ... /J --- Quote End --- Thanks! you are right!

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page