- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
My code:
Int is an Integer Variable OutputNumber is a Std_logic_Vector Input Int <= conv_integer(OutputNumber); MyVector(37 downto (38-Int)) <= Temp(37 downto (38-Int)); Quartus Compiler Error: Error (10454): VHDL syntax error: right bound of range must be a constant PLEASE HELP ME.Link Copied
7 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The VHDL standard does not allow the right-hand side of downto expresions to contain a variable.
Just use a constant instead of a Int Integer variable.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for reply, but i don't know the value of Int. I must convert the "OutputNumber" input to know the value of Int.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
From your code snippet, it's not fully clear, what you want to achieve. If you want to copy a variable number of bits depending on another condition, you can use a for loop iteration scheme.
for i in 0 to 37 loop
if i >= 38 - int then
MyVector(i) <= Temp(i);
end if;
end loop;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
"OutputNumber" is a Std_logic_Vector(5 downto 0). It is a vector that store the number of output (eg.: "000000" means no outputs; "01010" means 10 outputs and so on....) The integer variable "Int" store the equivalent integer value: No outputs: Int:=0; 10 outputs: Int:=10 and so on..... "Temp" is a 38bit vector, but i need to copy only a range to "MyVector" Int <= conv_integer(OutputNumber); MyVector(37 downto (38-Int)) <= Temp(37 downto (38-Int)); Quartus Compiler Error: Error (10454): VHDL syntax error: right bound of range must be a constant- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Amilcar has already explained, that your code isn't valid VHDL. Try as I suggested or use a similar construct according to VHDL syntax rules.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok, so can you help me with an alternative solution?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
FvM already gave you an alternative solution.
One other solution would be: if (OutputNumber == "000000") then MyVector(37 downto (38-0)) <= Temp(37 downto (38-0)); <- This is wrong because your code was wrong end if (OutputNumber == "000001") then MyVector(37 downto (38-1)) <= Temp(37 downto (38-1)); end if (OutputNumber == "000010") then MyVector(37 downto (38-2)) <= Temp(37 downto (38-2)); end if (OutputNumber == "000011") then MyVector(37 downto (38-3)) <= Temp(37 downto (38-3)); end if (OutputNumber == "000100") then MyVector(37 downto (38-4)) <= Temp(37 downto (38-4)); end ... if (OutputNumber == "01010") then MyVector(37 downto (38-10)) <= Temp(37 downto (38-10)); end There is no need to use conv_integer. And pleas use numeric_std instead of standard_arith
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