Forum for Electronics

  • Search forums

Follow along with the video below to see how to install our site as a web app on your home screen.

Note: This feature may not be available in some browsers.

Welcome to EDAboard.com

Welcome to our site edaboard.com is an international electronics discussion forum focused on eda software, circuits, schematics, books, theory, papers, asic, pld, 8051, dsp, network, rf, analog design, pcb, service manuals... and a whole lot more to participate you need to register. registration is free. click here to register now..

  • Digital Design and Embedded Programming
  • PLD, SPLD, GAL, CPLD, FPGA Design

Procedural Assignment error (verilog )

  • Thread starter vead
  • Start date Sep 23, 2014
  • Sep 23, 2014

Full Member level 5

hello , when i compile code I am getting following error line if (ld==1) q4 <= d4; Error (10137): Verilog HDL Procedural Assignment error at core_v.v(70): object "q4" on left-hand side of assignment must have a variable data type Code: module core_v(clk,ld,d0, q0,d1,d2,q1,q2,a,b,z,sel,d,q,d3,q3,d4,q4 ); input clk; input ld; reg [3:0] q0; reg [3:0] q1; reg [3:0] q2; reg [3:0] z; //add r0 core_v core_vr0 ( d0, q0); input [3:0] d0; output q0; always @(posedge clk) begin if (ld==1) q0 <= d0; end // add r1 core_v core_vr1 ( d1, q1); input d1; output q1; always @(posedge clk) begin if (ld==1) q1 <= d1; end //add r2 core_v core_vr2_i ( d2, q2); input d2; output q2; always @(posedge clk) begin if (ld==1) q2 <= d2; end // add acc core_v core_vacc( d, q); input d; output q; reg [3:0] q; always @(posedge clk) begin if (ld==1) q <= d; end //add temacc core_v core_tempacc(d3,q3 ); input d3; output q3; always @(posedge clk) begin if (ld==1) q <= d; end // add accreg core_v core_tempreg(clk, ld, d4, q4); input d4; output q4; always @(posedge clk) begin if (ld==1) q4 <= d4; end //add alu core_v core_alu (z,a,b,sel); input a, b; input sel; output z; always@(sel,a,b) begin case(sel) 4'b0000: z=a+b; 4'b0001: z=a-b; 4'b0010: z=b-1; 4'b0011: z=a*b; 4'b0100: z=a&&b; 4'b0101: z=a||b; 4'b0110: z=!a; 4'b0111: z=~a; 4'b1000: z=a&b; 4'b1001: z=a|b; 4'b1010: z=a^b; 4'b1011: z=a<<1; 4'b1100: z=a>>1; 4'b1101: z=a+1; 4'b1110: z=a-1; endcase end endmodule how to remove this error  

Advanced Member level 3

It would really help if you would declare your ports using the syntax added by Verilog-2001. It is 2014 after all. How did you declare "q4".  

dave_59 said: It would really help if you would declare your ports using the syntax added by Verilog-2001. It is 2014 after all. How did you declare "q4". Click to expand...

Full Member level 6

What exactly are you trying to do here? This code makes no sense. You have declared a module called core_v, inside of which you are instantiating copies of core_v (which you can't do) and doing it incorrectly anyway as you are not listing all the ports of core_v. And then you intersperse these instantiations with some Verilog code. I am guessing that what you are trying to do is create a module called core_v which instantiates other submodules which contain various functions. But this is certainly not the way to do it. You need to get yourself a Verilog book and find some proper examples of this. Assuming this is what you want to do. r.b.  

look the diagram 2.13 I want write verilog code for that circuit **broken link removed** - - - Updated - - - http://msxarchive.nl/pub/msx/mirrors/msx2.com/zaks/z80prg02.htm  

I don't want to retype what is easily found on the web already, so here is a link that shows how to write a module that instantiates other modules. As for the diagram, you as the designer will have to decide how you want to divide up the functionality. If it is a small amount of code, you might just write all of it in the main module and dispense with sub-modules. Or make the register block a sub-module and write the rest directly in the main module. Or any other way you feel is useful to you. r.b.  

  • Sep 24, 2014
rberek said: I don't want to retype what is easily found on the web already, so here is a link that shows how to write a module that instantiates other modules. As for the diagram, you as the designer will have to decide how you want to divide up the functionality. If it is a small amount of code, you might just write all of it in the main module and dispense with sub-modules. Or make the register block a sub-module and write the rest directly in the main module. Or any other way you feel is useful to you. r.b. Click to expand...

TrickyDicky

Advanced member level 7.

The error comes because you are instantiating the adder_implicit module inside itself, giving infinite recursion.  

TrickyDicky said: The error comes because you are instantiating the adder_implicit module inside itself, giving infinite recursion. Click to expand...

You are still not getting it. What is u0 supposed to do be doing? Unfortunately, that website I pointed you to does not show the best example of writing a module. I should have looked closer. Here is a super simple Verilog module: Code: module blah ( input wire a, input wire b, output wire c ); assign c = a | b; endmodule You do not need to instantiate a module inside itself as you have been trying to do. r.b.  

rberek said: You are still not getting it. What is u0 supposed to do be doing? Unfortunately, that website I pointed you to does not show the best example of writing a module. I should have looked closer. Here is a super simple Verilog module: Code: module blah ( input wire a, input wire b, output wire c ); assign c = a | b; endmodule You do not need to instantiate a module inside itself as you have been trying to do. r.b. Click to expand...

What are you trying to do with that code? What did you think it would do? Is it supposed to be an instantiation of something? Its not legal Verilog as far as I know, so if you tell us what this was trying to achieve, maybe we can help. r.b.  

ads-ee

Super Moderator

Go back and look at rberek's link in #6 Your code: Code: // Code Starts Here u0( r1[0] , r2[0] , ci , result[0] , c1 ); is incorrectly written compared to the example in #6. Code: // Code Starts Here [B][I][COLOR="#FF0000"]addbit[/COLOR][/I][/B] u0( r1[0] , r2[0] , ci , result[0] , c1 ); You need to compile the addbit.v module first, so when you compile the adder_implicit module it can find something to fill the spot for u0. BTW implicit ordering of ports on an instantiated module is NOT recommended. It is better to use named ordering of the ports. i.e. .port_name (port_connection_name), ... You should read a book on Verilog, instead of flailing around trying to learn Verilog from poorly written website tutorials. I initially learned Verilog using the Thomas/Moorby book and later bought Verilog HDL by Palnitkar. I only use websites as a quick reference.  

ok i want to write code for following example there are three registers that are connected with single data bus I have written code but getting error Code: module register (clk, ld, d0,d1,d2,q0,q1,q2); input clk; input ld; // Input Port Declarations input [3:0] d0 ; input [3:0] d1 ; input [3:0] d2 ; // Output Port Declarations output [3:0] q0; output [3:0] q1; output [3:0] q2; // ports wire wire [3:0] c0; wire [3:0] c1; wire [3:0] c2; reg [3:0]q0; always @(posedge clk) begin if (ld==1) q0 <= d0; end reg [3:0]q1; always @(posedge clk) begin if (ld==1) q1 <= d1; end reg [3:0]q2; always @(posedge clk) begin if (ld==1) q2 <= d2; end register r0 (clk,ld,d0,q0,so); register r1 ( clk,ld,d1, q1,s1); register r2 ( clk, ld,d2, q2,s2); endmodule endmodule Verilog HDL syntax error at register.v(40) near text "endmodule"  

Your error line number, 40, doesn't match the number of lines in the code you posted. You should use add a comment to the line that throws the error. Now I do notice you have two endmodule statements. You should only have one endmodule statement for a module. You are also still instantiating the module register inside the module register . rberek has told you multiple times that you can't do that. If you don't take the advice from forum members that do this stuff professionally then why bother asking any questions? - - - Updated - - - You know looking at your code some more you don't seem to understand anything about Verilog or how to comment code properly. Comments should tell why you did something and/or what it does somewhere else in the code. Not obvious stuff like "here are the input ports"...how about...// three DFF inputs that are captured by ld on the rising edge of clk Code: module register (clk, ld, d0,d1,d2,q0,q1,q2); input clk; input ld; // Input Port Declarations ---- ads-ee useless comment not even worth typing this input [3:0] d0 ; input [3:0] d1 ; input [3:0] d2 ; // Output Port Declarations ---- ads-ee useless comment not even worth typing this output [3:0] q0; output [3:0] q1; output [3:0] q2; Typical antiquated Verilog 87 method taught to B/M-Tech students when Verilog 2001 port syntax is supported by every single vendor. Code: module register ( input clk, // common D-FF load signal, active high input ld, // D-FF inputs input [3:0] d0, input [3:0] d1, input [3:0] d2, // D-FF outputs output reg [3:0] q0, output reg [3:0] q1, output reg [3:0] q2 ); This is how you do this in Verilog 2001. you don't even use these signals? Code: // ports wire wire [3:0] c0; wire [3:0] c1; wire [3:0] c2; What is with this crazy indenting? Code: reg [3:0]q0; always @(posedge clk) begin if (ld==1) q0 <= d0; end reg [3:0]q1; always @(posedge clk) begin if (ld==1) q1 <= d1; end reg [3:0]q2; always @(posedge clk) begin if (ld==1) q2 <= d2; end Reformated and cleaned up so it's readable. Code: always @(posedge clk) begin if (ld) q0 <= d0; end always @(posedge clk) begin if (ld) q1 <= d1; end always @(posedge clk) begin if (ld) q2 <= d2; end Your trying to instantiate the register module inside itself. This is illegal. Besides that your register instances don't even have the same number of ports as the register module. Code: module [COLOR="#FF0000"]register[/COLOR] (clk, ld, d0,d1,d2,q0,q1,q2); //... [COLOR="#FF0000"]register[/COLOR] r0 (clk,ld,d0,q0,so); [COLOR="#FF0000"]register[/COLOR] r1 ( clk,ld,d1, q1,s1); [COLOR="#FF0000"]register[/COLOR] r2 ( clk, ld,d2, q2,s2); What can I say...there are too many endmodule statements here. Code: endmodule endmodule  

mrflibble

Advanced Member level 5

You are also still instantiating the module register inside the module register. rberek has told you multiple times that you can't do that. If you don't take the advice from forum members that do this stuff professionally then why bother asking any questions? Click to expand...
vead said: when I don't use instantiating the module then I get more error as you said i write code without instantiating the module but tell me why I am getting error Code: module core_v(A,B,Cin,S,Cout); input A, B, Cin; output S, Cout; wire S1, C1, C2; (A, B, S1, C1); (S1, Cin, S, Cout); (Cout, C1, C2); endmodule error Code: Error: Quartus II Analysis & Synthesis was unsuccessful. 9 errors, 0 warnings Error: Peak virtual memory: 230 megabytes Error: Processing ended: Thu Sep 25 10:36:30 2014 Error: Elapsed time: 00:00:05 Error: Total CPU time (on all processors): 00:00:03 Click to expand...

finally I made some code with no error Code: module core_v (clk, ld, d0,q0); // Input Port Declarations input clk; input ld; input [3:0] d0 ; wire [3:0] c0; // Output Port Declarations output [3:0] q0; reg [3:0]q0; always @(posedge clk) begin if (ld==1) q0 <= d0; end endmodule module registerr1(clk,ld,d1,q1); input [3:0] d1 ,clk,ld; output [3:0] q1; wire [3:0] c1; reg [3:0]q1; always @(posedge clk) begin if (ld==1) q1 <= d1; end endmodule module register2 (clk,ld,d2,q2); input [3:0] d2,clk,ld ; output [3:0] q2; wire [3:0] c2; reg [3:0]q2; always @(posedge clk) begin if (ld==1) q2 <= d2; end core_v r0 (clk,ld,d0,q0,s0); core_v r1 (clk,ld,d1q1,s1); core_v r2 (clk,ld,d2,d2,s2); endmodule  

Similar threads

  • Started by EDA_hg81
  • Sep 17, 2023
  • Started by Luchete 1
  • May 7, 2023
  • Started by keikaku
  • Mar 5, 2024
  • Replies: 10
  • Started by mahesh_namboodiri
  • Jan 31, 2024
  • Started by Natasha_
  • Nov 23, 2023

Part and Inventory Search

Welcome to edaboard.com.

  • This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register. By continuing to use this site, you are consenting to our use of cookies. Accept Learn more…

Success! Subscription added.

Success! Subscription removed.

Sorry, you must verify to complete this action. Please click the verification link in your email. You may re-send via your profile .

  • Intel Community
  • Product Support Forums
  • Intel® Quartus® Prime Software

How Formulas Determine Variable Data Types

Variables can be of these data types: numeric, text or date. The data type determines the type of information the variable holds.

You don't have to specify the variable type. Formulas determine the type based on how you use the variable. For example, if you set a variable to 'J. Smith', the formula interprets it as a text variable.

Determine Variable Data Types

Formulas process the rules that determine the variable data type in the order listed:

The variable can be an input you name in the input statement. For example:

If you don't specify the variable data type in the statement, the formula assumes it's a number.

You can use the DEFAULT_FOR statement to determine the variable data type:

For an array database item, the DEFAULT FOR statement determines the index type and value type:

You can use the DEFAULT_DATA_VALUE FOR statement to determine the variable data type:

The formula searches the list of database items. If the variable is in the list, the data type is known.

If the variable appears in a context handling statement, then the formula searches the list of contexts. If the variable is in the list, then the formula knows the data type, otherwise it returns an error.

If the variable isn't a database item or a context, then the formula treats it as a local variable and determines the data type based on how you use the variable. For example:

IMAGES

  1. VB Beginner 3

    assignment must have a variable data type

  2. Variables, Assignment & Data Types

    assignment must have a variable data type

  3. Complete Guide and Tutorials for PHP Variables & Data type with example

    assignment must have a variable data type

  4. #12 Variable, Data Types & Identifiers in Python Step by Step

    assignment must have a variable data type

  5. How to Use Excel VBA Variable Data Types

    assignment must have a variable data type

  6. Window to Statistics for Beginners: Topic 1

    assignment must have a variable data type

VIDEO

  1. C Variable Data type

  2. Data Type and Variable in C

  3. 2-2 Data Type, Variable, and Statement

  4. PHP Variable data type mentioning

  5. PHP ► Using Variable and Data Type Part A

  6. C++ Variables, Literals, an Assignment Statements [2]

COMMENTS

  1. Verilog Error: Object on left-hand side of assignment must have a

    Hi Greg - I can't find anything in 1364-2005 which would make this code (or mine) invalid. In fact, 12.3.3 explicitly allows it - note "in the body of the module", and the output reg production. The confusion may be due to the text at the bottom of 12.3.3, which states that if the decl doesn't include a net or variable type, then it can be declared again in a net or variable decl, and the ...

  2. verilog error left-hand side of assignment must have a variable data type

    You have declared result in you module declaration to be of type wire. You can't assign values to wires in always blocks. Instead you should declare result as the correct type as explained in this StackOverflow question (thanks @Greg). output [31:0] result; reg [31:0] result; This makes it of reg type which can be assigned in an always block.

  3. Electronics: verilog error left-hand side of assignment must have a

    Electronics: verilog error left-hand side of assignment must have a variable data typeHelpful? Please support me on Patreon: https://www.patreon.com/roelvan...

  4. ID:10137 Verilog HDL Procedural Assignment error at <location>: object

    CAUSE: In a procedural assignment at the specified location in a Verilog Design File (), you assigned a value to the specified object, which was declared with a net data type (wire, wand, and so on) rather than with a variable data type (reg, integer, and so on).In Verilog HDL, you must use continuous assignments when targeting nets, and procedural assignments when targeting variables.

  5. object "y" on left-hand side of assignment must have a variable data type

    写verilog出现object "key_v" on left hand side of assignment must have a variable data type 06-03 这个错误通常在 Verilog 语法中遇到,它表示在赋值语句或声明语句的左侧出现了一个没有定义数据类型的标识符,例如 `key_v`。

  6. Why does the assignment operator assign to the left-hand side?

    In pseudocode the assignment operator is very commonly written on the right. For example. 2*sqrt(x)/(3+y) -> z In Casio calculators, even non-programmable variants, the assignment variable is also displayed on the right. A+2B → C In Forth the variable is on the right, too. expression variable !

  7. Getting an error :object "led" on left-hand side of assignment must

    Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)

  8. Getting an error :object "led" on left-hand side of assignment must

    You need to declare 'led' as a reg, in the same way you've declared counter. Declaring it as an output to the module isn't enough (as it is in other languages). You can either add: reg led; or change the output declaration to: output reg led; Cheers, Alex

  9. Error (10219): Verilog HDL Continuous Assignment error at Mux.v(19

    In verilog, lines can have two overarching types, either nets (like wire type) or variables (like reg types). To assign values/logic to net types, you need to use assign statements and not always blocks. To assign values/logic to variable types, you can only use always blocks and not assign statements.

  10. Error: HDL Compiler : 1660 : Procedural assignment to a non-register

    Tour Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site

  11. D flip flop in verilog

    If you assign to something in a continual assignment (either an assign statement or the output of an instance of a module) you need to make it a wire type. So you need to declare (You already edited this change into your question) wire D; on line 5, and. output reg Dout; on line 2. Also, D is somewhat superfluous. You could just have

  12. I am getting one error while compiling my code in Quartus II that

    Fixed and floating point date type synthesizable HDL code what are the diff ways/tricks/new& diff ideas that a fixed or floating point algorithm can be implemented in FPGA using Verilog and the ...

  13. Procedural Assignment error (verilog )

    bidirectional data bus three instances of the register ALU one instance of register, with bidirectional data path, load/!store input, enable input and clock input. All connected together core.v will have as i/o the clkoc, data bus, and all the control signals look the diagram 2.13

  14. The left-hand side of an assignment must be a variable

    5 = 6; // "Assign 5 to 6" The left side (5) isn't variable. Why is this example statement relevant? Because of Java uses always "pass by value". Which means that the return value of a method is also "return by value". This is pure mathematical: you can't change a value, you can change a variable. The same for Java. Five can never become six.

  15. Verilog Code Error: Counter : Read and writer through PIO

    output port "out" must have reg data type so replace "output wire[7:0] out" with "output reg[7:0] out" Let me know if this has helped resolve the issue you are facing or if you need any further assistance. Best Regards. Vikas Jathar (This message was posted on behalf of Intel Corporation)

  16. Concurrent assignment or output port connection should be a net type

    Although it is Cliff's proposal to remove Type Reg, as part of that, he explains Verilog types in detail in this paper. This paper will detail the differences between register and net data types and propose an enhancement to the Verilog language that would eliminate the need to declare register data types altogether

  17. Verilog compilation error when attempting to output to LED

    EDIT: Figured it out. I assigned the LEDR[0] wire to the value of a register that I put in place of the LEDR[0]. I guess it makes sense since you cannot have a wire acting as a register. Hi guys, I'm trying to get this block working. I get the error:

  18. verilog

    So the change suggested by Greg is allowed, rather than required (reg is of course a 'variable type'). In other words, if you don't have output reg x, then you are allowed to split this over two statements - output x and reg x. SystemVerilog (1800-2012) is essentially identical - note that reg is an integer_vector_type, which is a data_type.

  19. Procedural Assignment error (verilog )

    Everyone wants the project to be good, fast, and cheap... pick two. " - Unknown

  20. ID:10137 Verilog HDL Procedural Assignment error at

    CAUSE: In a procedural assignment at the specified location in a Verilog Design File (), you assigned a value to the specified object, which was declared with a net data type (wire, wand, and so on) rather than with a variable data type (reg, integer, and so on).In Verilog HDL, you must use continuous assignments when targeting nets, and procedural assignments when targeting variables.

  21. Problems assigning to LEDs in a case block

    Using an assign like that you are most likely not doing what you expect. See using-a-continous-assignment-in-a-verilog-procedure for an explanation of what your currently doing. To expand in DJZygotes answer, LEDG must be a wire for continuous assign or reg for assignment in an always or initial block. wire [7:0] LEDG; assign LEDG = SW[7:0]; Or:

  22. How Formulas Determine Variable Data Types

    You can use the DEFAULT_DATA_VALUE FOR statement to determine the variable data type: DEFAULT_DATA_VALUE FOR A IS 0 /* A could be a NUMBER_NUMBER or NUMBER_TEXT variable. */. The formula searches the list of database items. If the variable is in the list, the data type is known. If the variable appears in a context handling statement, then the ...