Continue to Site

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.

Syntax error in verilog

Status
Not open for further replies.

Mustaine

Member level 1
Joined
Mar 27, 2021
Messages
32
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Activity points
214
In the example that i took from digital design by morris mano, there is a syntax error that i con not fix can you help me about that.
thanks in advance.
error code is = syntax error near "[". (line11)
note: undeclared symbol select, assumed default net type wire (line 14)
 

Attachments

  • pic.JPG
    pic.JPG
    101.2 KB · Views: 240
  • pic1.JPG
    pic1.JPG
    52.9 KB · Views: 192

According to rules of this forum (https://www.edaboard.com/help/terms/): Use CODE/SYNTAX tags
How to proceed: https://www.edaboard.com/threads/how-to-apply-code-and-syntax-tags.321025/

Regarding your question:
-> Google -> "assign verilog" -> first link
Should be
assign select[1:0] = ...

In addition: port mapping while instantiation of the module can be done in two different ways i.e. “Port mapping by order” and “Port mapping by name“.
You're using port mapping by order, which is more error prone.
I suggest to use port mapping by name. Always.
 
Last edited:

According to rules of this forum (https://www.edaboard.com/help/terms/): Use CODE/SYNTAX tags
How to proceed: https://www.edaboard.com/threads/how-to-apply-code-and-syntax-tags.321025/

Regarding your question:
-> Google -> "assign verilog" -> first link
Should be
assign select[1:0] = ...

In addition: port mapping while instantiation of the module can be done in two different ways i.e. “Port mapping by order” and “Port mapping by name“.
You're using port mapping by order, which is more error prone.
I suggest to use port mapping by name. Always.
I didn't know the rules so thanks for the warning.
After i changed the the code the way you said, again it gives me error as below
what do i do wrong
 

Attachments

  • pics.png
    pics.png
    11.7 KB · Views: 147

You never declared select in your code, so it defaults to a 1-bit wire type.

Add wire [1:0] select; after your module declaration and before the assign.
 

You never declared select in your code, so it defaults to a 1-bit wire type.

Add wire [1:0] select; after your module declaration and before the assign.
thanks for your reply but after i added the code it still gives me the same error.
 

Attachments

  • pic.png
    pic.png
    12.9 KB · Views: 114

You repeated your original mistake of putting the [1:0] in front of the name. See post #2.

Read a Verilog tutorial to learn the syntax, so far all your errors are basic syntax rule violations.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top