VHDL - ror and rol operations












1















How can I solve this problem?
reg variable is defined as:



 signal reg:STD_LOGIC_VECTOR(7 downto 0):="00000001";


There is a problem with ror operation in the code below. The error message is:



Line 109: Syntax error near "ror".

Line 108: found '0' definitions of operator "=", cannot determine exact overloaded matching definition for "="


--



  process(clk1,up_down,enable,reset)
begin
if up_down="1" then
reg ror 1;
end if;
end process;









share|improve this question























  • What is the type of up_down? The string literal "1" is not of that type. For each type declaration other than file and protected types there's an equality ("=") and inequality operator "/=" defined. A string literal's type is from context and must be a single dimensional array type with character enumeration elements (such as string, std_ulogic_vector, etc). Without a Minimal, Complete, and Verifiable example a fix isn't apparent for the line 108 error.

    – user1155120
    Nov 20 '18 at 10:13


















1















How can I solve this problem?
reg variable is defined as:



 signal reg:STD_LOGIC_VECTOR(7 downto 0):="00000001";


There is a problem with ror operation in the code below. The error message is:



Line 109: Syntax error near "ror".

Line 108: found '0' definitions of operator "=", cannot determine exact overloaded matching definition for "="


--



  process(clk1,up_down,enable,reset)
begin
if up_down="1" then
reg ror 1;
end if;
end process;









share|improve this question























  • What is the type of up_down? The string literal "1" is not of that type. For each type declaration other than file and protected types there's an equality ("=") and inequality operator "/=" defined. A string literal's type is from context and must be a single dimensional array type with character enumeration elements (such as string, std_ulogic_vector, etc). Without a Minimal, Complete, and Verifiable example a fix isn't apparent for the line 108 error.

    – user1155120
    Nov 20 '18 at 10:13
















1












1








1








How can I solve this problem?
reg variable is defined as:



 signal reg:STD_LOGIC_VECTOR(7 downto 0):="00000001";


There is a problem with ror operation in the code below. The error message is:



Line 109: Syntax error near "ror".

Line 108: found '0' definitions of operator "=", cannot determine exact overloaded matching definition for "="


--



  process(clk1,up_down,enable,reset)
begin
if up_down="1" then
reg ror 1;
end if;
end process;









share|improve this question














How can I solve this problem?
reg variable is defined as:



 signal reg:STD_LOGIC_VECTOR(7 downto 0):="00000001";


There is a problem with ror operation in the code below. The error message is:



Line 109: Syntax error near "ror".

Line 108: found '0' definitions of operator "=", cannot determine exact overloaded matching definition for "="


--



  process(clk1,up_down,enable,reset)
begin
if up_down="1" then
reg ror 1;
end if;
end process;






syntax vhdl xilinx






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 20 '18 at 8:56









kaann45kaann45

94




94













  • What is the type of up_down? The string literal "1" is not of that type. For each type declaration other than file and protected types there's an equality ("=") and inequality operator "/=" defined. A string literal's type is from context and must be a single dimensional array type with character enumeration elements (such as string, std_ulogic_vector, etc). Without a Minimal, Complete, and Verifiable example a fix isn't apparent for the line 108 error.

    – user1155120
    Nov 20 '18 at 10:13





















  • What is the type of up_down? The string literal "1" is not of that type. For each type declaration other than file and protected types there's an equality ("=") and inequality operator "/=" defined. A string literal's type is from context and must be a single dimensional array type with character enumeration elements (such as string, std_ulogic_vector, etc). Without a Minimal, Complete, and Verifiable example a fix isn't apparent for the line 108 error.

    – user1155120
    Nov 20 '18 at 10:13



















What is the type of up_down? The string literal "1" is not of that type. For each type declaration other than file and protected types there's an equality ("=") and inequality operator "/=" defined. A string literal's type is from context and must be a single dimensional array type with character enumeration elements (such as string, std_ulogic_vector, etc). Without a Minimal, Complete, and Verifiable example a fix isn't apparent for the line 108 error.

– user1155120
Nov 20 '18 at 10:13







What is the type of up_down? The string literal "1" is not of that type. For each type declaration other than file and protected types there's an equality ("=") and inequality operator "/=" defined. A string literal's type is from context and must be a single dimensional array type with character enumeration elements (such as string, std_ulogic_vector, etc). Without a Minimal, Complete, and Verifiable example a fix isn't apparent for the line 108 error.

– user1155120
Nov 20 '18 at 10:13














1 Answer
1






active

oldest

votes


















4














Your problem is the the ror operator is not defined for std_logic_vector.



VHDL exhibits a behaviour of computer (and hardware description) languages called overloading. Overloading is where an operator, function or procedure is multiply defined for different types. The compiler looks at the combination of types when the operator (etc) is used (called the signature) and tries it match that with the various versions that have been declared. This only works if there is exactly one match. Any more and the code is ambiguous, because the compiler doesn't know which version to used. Any less and there is no version for the compiler to use. This is your problem - there is no version of the ror operator that uses std_logic_vector.



You have two solutions:



(i) RECOMMENDED : implement your rotate right behaviour manually using the concatenation operator and slicing:



    if up_down="1" then
reg <= reg(0) & reg(7 downto 1);
end if;


(ii) NOT RECOMMENDED : convert your std_logic_vector to a different type that does have a version of the ror operator defined, eg unsigned. Why "not recommended"? Because I would not recommend using any the the following operators ever, because they can behave strangely (and their behaviour doesn't seem to be consistent across different EDA tools);



ror rol sla sra sll srl




By the way, this line would be wrong even if ror were defined for std_logic_vector:



reg ror 1;


You can't just say that any more than you could just say



reg + 1;


You need to assign the result of the operation in both cases to something. I have assumed you want to assign it to reg in both cases.






share|improve this answer
























  • The corresponding sequence of statements is executed for a condition returning TRUE in an if statement. reg ror 1 is a shift expression not a sequential statement (IEEE Std 1076-2008 10.8 If statement, 9. Expressions, 9.1 shift_expression, 9.2.4 Shift operators, 10. Sequential statements). Without knowing the type of up_down you can tell "1" isn't of that type. The equality operator (9.2.3 Relational operators) is defined for all types other than file and protected types. The type of a string literal is determined by context and shall be a single dimensional array type (9.3.2 Literals).

    – user1155120
    Nov 20 '18 at 10:07











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53389379%2fvhdl-ror-and-rol-operations%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









4














Your problem is the the ror operator is not defined for std_logic_vector.



VHDL exhibits a behaviour of computer (and hardware description) languages called overloading. Overloading is where an operator, function or procedure is multiply defined for different types. The compiler looks at the combination of types when the operator (etc) is used (called the signature) and tries it match that with the various versions that have been declared. This only works if there is exactly one match. Any more and the code is ambiguous, because the compiler doesn't know which version to used. Any less and there is no version for the compiler to use. This is your problem - there is no version of the ror operator that uses std_logic_vector.



You have two solutions:



(i) RECOMMENDED : implement your rotate right behaviour manually using the concatenation operator and slicing:



    if up_down="1" then
reg <= reg(0) & reg(7 downto 1);
end if;


(ii) NOT RECOMMENDED : convert your std_logic_vector to a different type that does have a version of the ror operator defined, eg unsigned. Why "not recommended"? Because I would not recommend using any the the following operators ever, because they can behave strangely (and their behaviour doesn't seem to be consistent across different EDA tools);



ror rol sla sra sll srl




By the way, this line would be wrong even if ror were defined for std_logic_vector:



reg ror 1;


You can't just say that any more than you could just say



reg + 1;


You need to assign the result of the operation in both cases to something. I have assumed you want to assign it to reg in both cases.






share|improve this answer
























  • The corresponding sequence of statements is executed for a condition returning TRUE in an if statement. reg ror 1 is a shift expression not a sequential statement (IEEE Std 1076-2008 10.8 If statement, 9. Expressions, 9.1 shift_expression, 9.2.4 Shift operators, 10. Sequential statements). Without knowing the type of up_down you can tell "1" isn't of that type. The equality operator (9.2.3 Relational operators) is defined for all types other than file and protected types. The type of a string literal is determined by context and shall be a single dimensional array type (9.3.2 Literals).

    – user1155120
    Nov 20 '18 at 10:07
















4














Your problem is the the ror operator is not defined for std_logic_vector.



VHDL exhibits a behaviour of computer (and hardware description) languages called overloading. Overloading is where an operator, function or procedure is multiply defined for different types. The compiler looks at the combination of types when the operator (etc) is used (called the signature) and tries it match that with the various versions that have been declared. This only works if there is exactly one match. Any more and the code is ambiguous, because the compiler doesn't know which version to used. Any less and there is no version for the compiler to use. This is your problem - there is no version of the ror operator that uses std_logic_vector.



You have two solutions:



(i) RECOMMENDED : implement your rotate right behaviour manually using the concatenation operator and slicing:



    if up_down="1" then
reg <= reg(0) & reg(7 downto 1);
end if;


(ii) NOT RECOMMENDED : convert your std_logic_vector to a different type that does have a version of the ror operator defined, eg unsigned. Why "not recommended"? Because I would not recommend using any the the following operators ever, because they can behave strangely (and their behaviour doesn't seem to be consistent across different EDA tools);



ror rol sla sra sll srl




By the way, this line would be wrong even if ror were defined for std_logic_vector:



reg ror 1;


You can't just say that any more than you could just say



reg + 1;


You need to assign the result of the operation in both cases to something. I have assumed you want to assign it to reg in both cases.






share|improve this answer
























  • The corresponding sequence of statements is executed for a condition returning TRUE in an if statement. reg ror 1 is a shift expression not a sequential statement (IEEE Std 1076-2008 10.8 If statement, 9. Expressions, 9.1 shift_expression, 9.2.4 Shift operators, 10. Sequential statements). Without knowing the type of up_down you can tell "1" isn't of that type. The equality operator (9.2.3 Relational operators) is defined for all types other than file and protected types. The type of a string literal is determined by context and shall be a single dimensional array type (9.3.2 Literals).

    – user1155120
    Nov 20 '18 at 10:07














4












4








4







Your problem is the the ror operator is not defined for std_logic_vector.



VHDL exhibits a behaviour of computer (and hardware description) languages called overloading. Overloading is where an operator, function or procedure is multiply defined for different types. The compiler looks at the combination of types when the operator (etc) is used (called the signature) and tries it match that with the various versions that have been declared. This only works if there is exactly one match. Any more and the code is ambiguous, because the compiler doesn't know which version to used. Any less and there is no version for the compiler to use. This is your problem - there is no version of the ror operator that uses std_logic_vector.



You have two solutions:



(i) RECOMMENDED : implement your rotate right behaviour manually using the concatenation operator and slicing:



    if up_down="1" then
reg <= reg(0) & reg(7 downto 1);
end if;


(ii) NOT RECOMMENDED : convert your std_logic_vector to a different type that does have a version of the ror operator defined, eg unsigned. Why "not recommended"? Because I would not recommend using any the the following operators ever, because they can behave strangely (and their behaviour doesn't seem to be consistent across different EDA tools);



ror rol sla sra sll srl




By the way, this line would be wrong even if ror were defined for std_logic_vector:



reg ror 1;


You can't just say that any more than you could just say



reg + 1;


You need to assign the result of the operation in both cases to something. I have assumed you want to assign it to reg in both cases.






share|improve this answer













Your problem is the the ror operator is not defined for std_logic_vector.



VHDL exhibits a behaviour of computer (and hardware description) languages called overloading. Overloading is where an operator, function or procedure is multiply defined for different types. The compiler looks at the combination of types when the operator (etc) is used (called the signature) and tries it match that with the various versions that have been declared. This only works if there is exactly one match. Any more and the code is ambiguous, because the compiler doesn't know which version to used. Any less and there is no version for the compiler to use. This is your problem - there is no version of the ror operator that uses std_logic_vector.



You have two solutions:



(i) RECOMMENDED : implement your rotate right behaviour manually using the concatenation operator and slicing:



    if up_down="1" then
reg <= reg(0) & reg(7 downto 1);
end if;


(ii) NOT RECOMMENDED : convert your std_logic_vector to a different type that does have a version of the ror operator defined, eg unsigned. Why "not recommended"? Because I would not recommend using any the the following operators ever, because they can behave strangely (and their behaviour doesn't seem to be consistent across different EDA tools);



ror rol sla sra sll srl




By the way, this line would be wrong even if ror were defined for std_logic_vector:



reg ror 1;


You can't just say that any more than you could just say



reg + 1;


You need to assign the result of the operation in both cases to something. I have assumed you want to assign it to reg in both cases.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 20 '18 at 9:07









Matthew TaylorMatthew Taylor

7,1612731




7,1612731













  • The corresponding sequence of statements is executed for a condition returning TRUE in an if statement. reg ror 1 is a shift expression not a sequential statement (IEEE Std 1076-2008 10.8 If statement, 9. Expressions, 9.1 shift_expression, 9.2.4 Shift operators, 10. Sequential statements). Without knowing the type of up_down you can tell "1" isn't of that type. The equality operator (9.2.3 Relational operators) is defined for all types other than file and protected types. The type of a string literal is determined by context and shall be a single dimensional array type (9.3.2 Literals).

    – user1155120
    Nov 20 '18 at 10:07



















  • The corresponding sequence of statements is executed for a condition returning TRUE in an if statement. reg ror 1 is a shift expression not a sequential statement (IEEE Std 1076-2008 10.8 If statement, 9. Expressions, 9.1 shift_expression, 9.2.4 Shift operators, 10. Sequential statements). Without knowing the type of up_down you can tell "1" isn't of that type. The equality operator (9.2.3 Relational operators) is defined for all types other than file and protected types. The type of a string literal is determined by context and shall be a single dimensional array type (9.3.2 Literals).

    – user1155120
    Nov 20 '18 at 10:07

















The corresponding sequence of statements is executed for a condition returning TRUE in an if statement. reg ror 1 is a shift expression not a sequential statement (IEEE Std 1076-2008 10.8 If statement, 9. Expressions, 9.1 shift_expression, 9.2.4 Shift operators, 10. Sequential statements). Without knowing the type of up_down you can tell "1" isn't of that type. The equality operator (9.2.3 Relational operators) is defined for all types other than file and protected types. The type of a string literal is determined by context and shall be a single dimensional array type (9.3.2 Literals).

– user1155120
Nov 20 '18 at 10:07





The corresponding sequence of statements is executed for a condition returning TRUE in an if statement. reg ror 1 is a shift expression not a sequential statement (IEEE Std 1076-2008 10.8 If statement, 9. Expressions, 9.1 shift_expression, 9.2.4 Shift operators, 10. Sequential statements). Without knowing the type of up_down you can tell "1" isn't of that type. The equality operator (9.2.3 Relational operators) is defined for all types other than file and protected types. The type of a string literal is determined by context and shall be a single dimensional array type (9.3.2 Literals).

– user1155120
Nov 20 '18 at 10:07


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53389379%2fvhdl-ror-and-rol-operations%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

MongoDB - Not Authorized To Execute Command

How to fix TextFormField cause rebuild widget in Flutter

in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith