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.

A few questions about Verilog

Status
Not open for further replies.

shaiko

Advanced Member level 5
Advanced Member level 5
Joined
Aug 20, 2011
Messages
2,644
Helped
303
Reputation
608
Reaction score
297
Trophy points
1,363
Activity points
18,302
Hello,

1. Does Verilog support 3D arrays?
2. Does Verilog support unconstrained ports in module declaration?
3. What is the Verilog equivalent to a VHDL generic?
4. What is the Verilog equivalent to a VHDL generic?
 

verylsi

Full Member level 2
Full Member level 2
Joined
Mar 12, 2012
Messages
123
Helped
16
Reputation
32
Reaction score
16
Trophy points
1,308
Activity points
2,130
Any number of array dimensions may be declared. Arrays of nets were
added in Verilog-2001.
FYR -


Does Verilog support unconstrained ports in module declaration?
I dnt know , looking for someone to answer.

The generate in this context is optional as a for loop outside procedural will be interpreted as generate for.

Parmeter is equivalent of genric in verilog
 
  • Like
Reactions: shaiko

    shaiko

    Points: 2
    Helpful Answer Positive Rating

shaiko

Advanced Member level 5
Advanced Member level 5
Joined
Aug 20, 2011
Messages
2,644
Helped
303
Reputation
608
Reaction score
297
Trophy points
1,363
Activity points
18,302
Any number of array dimensions may be declared.
But would it synthesize?

Arrays of nets were added in Verilog-2001.
I know about "wire" & "reg"...but what is a Verilog net ?
 

ads-ee

Super Moderator
Staff member
Advanced Member level 7
Joined
Sep 10, 2013
Messages
7,942
Helped
1,822
Reputation
3,654
Reaction score
1,807
Trophy points
1,393
Location
USA
Activity points
60,185
Mulitdimensional arrays are synthesizable (note I did not use it to infer RAM).

Wire and reg are Verilog net types. There aren't that many types in Verilog but there are some.

In sythesizable Verilog I've never heard of unconstrained ports. If it exists I would check the SV additions. I haven't gone thru the entire LRM, as I can't use any of the SV features, due to lack of tool support.
 
  • Like
Reactions: shaiko

    shaiko

    Points: 2
    Helpful Answer Positive Rating

gs65

Member level 1
Member level 1
Joined
Sep 9, 2014
Messages
39
Helped
11
Reputation
22
Reaction score
11
Trophy points
8
Location
Bangalore,India
Activity points
199
@ ads-ee
as of my knowledge multi dimensional arrays are not synthesizable.. i tried it .. i did not get... if i am wrong , can u suggest me an example which is synthesizable.
 

TrickyDicky

Advanced Member level 7
Advanced Member level 7
Joined
Jun 7, 2010
Messages
7,109
Helped
2,080
Reputation
4,179
Reaction score
2,045
Trophy points
1,393
Activity points
39,763
@ ads-ee
as of my knowledge multi dimensional arrays are not synthesizable.. i tried it .. i did not get... if i am wrong , can u suggest me an example which is synthesizable.

I doubt this statement somewhat, as the small amount of verilog Ive done (though it was SV) had a 2d array of signed and unsigned values in several ports. It synthesised just fine in Quartus.
 

shaiko

Advanced Member level 5
Advanced Member level 5
Joined
Aug 20, 2011
Messages
2,644
Helped
303
Reputation
608
Reaction score
297
Trophy points
1,363
Activity points
18,302
TrickyDicky,

What about unconstrained ports (single or multidimensional )?
 

TrickyDicky

Advanced Member level 7
Advanced Member level 7
Joined
Jun 7, 2010
Messages
7,109
Helped
2,080
Reputation
4,179
Reaction score
2,045
Trophy points
1,393
Activity points
39,763
Normal verilog does not support open arrays on ports. System verilog does.
 
  • Like
Reactions: shaiko

    shaiko

    Points: 2
    Helpful Answer Positive Rating

FvM

Super Moderator
Staff member
Advanced Member level 7
Joined
Jan 22, 2008
Messages
51,221
Helped
14,653
Reputation
29,584
Reaction score
13,799
Trophy points
1,393
Location
Bochum, Germany
Activity points
292,769
Reviewing this thread is somehow frustrating. All questions that have been asked are answered in the Verilog and System Verilog LRM. Regarding synthesis, you can either refer to IEEE 1364.1 or in most cases apply common sense:

What kind of reasons hinders a language feature to be synthesized?
If it can't be represented in actual hardware.
Think again!
 

TrickyDicky

Advanced Member level 7
Advanced Member level 7
Joined
Jun 7, 2010
Messages
7,109
Helped
2,080
Reputation
4,179
Reaction score
2,045
Trophy points
1,393
Activity points
39,763
I was about to post a similar point - it sounds like you're annoyed you cant do what you wanted in your other threads in VHDL, so now you're considering verilog.

If you're fighting the language, you're probably doing it wrong.
 

shaiko

Advanced Member level 5
Advanced Member level 5
Joined
Aug 20, 2011
Messages
2,644
Helped
303
Reputation
608
Reaction score
297
Trophy points
1,363
Activity points
18,302
refer to IEEE 1364.1 or in most cases apply common sense:

What kind of reasons hinders a language feature to be synthesized?
If it can't be represented in actual hardware.
Think again!

I don't see how N sized arrays and ports that get constrained according to the signal that drives them defies common sense.

it sounds like you're annoyed you cant do what you wanted in your other threads in VHDL, so now you're considering Verilog.
Not at all. I'm not on a search for alternatives to VHDL...just trying to educate myself about the differences between both HDLs.

If you're fighting the language, you're probably doing it wrong.
I disagree with this statement. Would you say the same thing about VHDL 1987 ?
Designers "fought" with that standard and that what lead to superseding standards.
 

ads-ee

Super Moderator
Staff member
Advanced Member level 7
Joined
Sep 10, 2013
Messages
7,942
Helped
1,822
Reputation
3,654
Reaction score
1,807
Trophy points
1,393
Location
USA
Activity points
60,185
Verilog allows stuff like this and it will synthesize. I've used it, but can't provide the code as it was done for a previous job.
Code:
wire [15:0] mult_dim_sig [0:7] [0:31];

The reason for doing something like this is when I've used generates that are connecting up multiple things that are naturally array like. So instead of some ugly unreadable code like:

Code:
wire [32*8*16-1:0] mult_dim_sig;
mult_dim_sig[16*(32*j+i) +:16] //This is probably not even indexing correctly, which is why I don't do this.

//I instead just code this (i:0-7, j:0-31)
mult_dim_sig[i][j]

//And if I just want a slice:
mult_dim_sig[i][j][11:8]
 

dave_59

Advanced Member level 3
Advanced Member level 3
Joined
Dec 15, 2011
Messages
832
Helped
365
Reputation
734
Reaction score
360
Trophy points
1,353
Location
Fremont, CA, USA
Activity points
7,142
No vendor ever claimed to support IEEE 1364.1. From my perspective, anything you can compile and execute in simulation can be synthesized. It's just a simple matter of programming, time and money.

SystemVerilog has dynamic arrays and parametrized functions that gives you similar functionality to an unconstrained array in VHDL. There is no reason these can't be synthesized with the proper constraints, but as far as I know, no synthesis tool does.
 

TrickyDicky

Advanced Member level 7
Advanced Member level 7
Joined
Jun 7, 2010
Messages
7,109
Helped
2,080
Reputation
4,179
Reaction score
2,045
Trophy points
1,393
Activity points
39,763
I disagree with this statement. Would you say the same thing about VHDL 1987 ?
Designers "fought" with that standard and that what lead to superseding standards.

Some fought, while the majority stuck with it and made money.
For a design that needs to be made, fighting against the language and tools is a silly idea.
By all means, make enhancement requests, use cases and try and get the language "improved", but in the mean time, you need to make do or you go bankrupt
 

FvM

Super Moderator
Staff member
Advanced Member level 7
Joined
Jan 22, 2008
Messages
51,221
Helped
14,653
Reputation
29,584
Reaction score
13,799
Trophy points
1,393
Location
Bochum, Germany
Activity points
292,769
No vendor ever claimed to support IEEE 1364.1. From my perspective, anything you can compile and execute in simulation can be synthesized. It's just a simple matter of programming, time and money.

Although not explicitely supported, 1364.1 chapter 5 (modelling hardware elements) is the only vendor independent specification of the synthesis syntax for synchronous hardware (clocked registers). I don't know if the syntax has been originally implemented by Synopsys or another tool company, but it has been adopted as a de-facto standard.

Apart from the hardware modelling point, I agree with "anything you can compile and execute in simulation".

There's no reason why e.g. multi-dimensional arrays that are defined in the LRM shouldn't be compilable to hardware, except for limitations in the language support of a specific tool.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top