Syntax Issues With Verilogger Pro (2001,2005 syntax to 1995 syntax)

  • Thread starter pags920
  • Start date
  • Tags
    Issues
In summary: In my test bench I have:initialbegin : inits1=0; s0=0; MSB_in=0; LSB_in=0; I_par=4'b0000; Clear=0;#10 Clear=1;#10 Clear=0;#50 s1=0; s0=1; MSB_in=0; LSB_in=0; I_par=4'b0000; Clear=0;#10 Clear=1;#10 Clear=0;#50 s1=1; s0=0; MSB_in=0; LSB_in=0; I_par=4'b0000; Clear=0;#10 Clear=1;#10 Clear
  • #1
pags920
21
0
I have the following example that I need to compile in using Verilogger Pro. The example is that of a 4-bit universal shift register. We are told to take the code from our textbook and create a test bench. I am not worried about test bench at this time, I am having problems compiling the code. The code given to us is in 2001,2005 syntax. Our compiler will only work in 1995 syntax. I have narrowed down the errors to one line, but knowing how the program works, it could be anywhere, I cannot find it. I have mailed my TA about this almost 2 days ago and have not gotten a response.

My question is where is the error in my code?


Code:
module Shift_Register_4_str (A_par, I_par, s1, s0, MSB_in, LSB_in, CLK, Clear);
output [3:0] A_par;
input [3:0] I_par;
input s1, s0, MSB_in, LSB_in, CLK, Clear;
assign [1:0] select = {s1,s0};
stage ST0 (A_par[0], A_par[1], LSB_in, I_par[0], A_par[0], select, CLK, Clear);
stage ST1 (A_par[1], A_par[2], A_par[0], I_par[1], A_par[1], select, CLK, Clear);
stage ST2 (A_par[2], A_par[3], A_par[1], I_par[2], A_par[2], select, CLK, Clear);
stage ST3 (A_par[3], MSB_in, A_par[2], I_par[3], A_par[3], select, CLK, Clear);
endmodule


module stage (i0, i1, i2, i3, Q, select, CLK, Clr);
input i0, i1, i2, i3;
output Q;
input [1:0] select;
input CLK, Clr;
wire mux_out;
Mux_4_x_1 M0 (mux_out, i0, i1, i2, i3, select);
D_flip_flop M1 (Q, mux_out, CLK, Clr);
endmodule

module Mux_4_x_1 (mux_out, i0, i1, i2, i3, select);
output mux_out;
input i0, i1, i2, i3;
input [1:0] select;
reg mux_out;
always @ (select or i0 or i1 or i2 or i3)
case (select)
2'b00: mux_out = i0;
2'b01: mux_out = i1;
2'b10: mux_out = i2;
2'b11: mux_out = i3;
endcase
endmodule

module D_flip_flop (Q, D, CLK, Clr);
output Q;
input D, CLK, Clr;
reg Q;

always @ (posedge CLK or negedge Clr)
if(~Clr)Q<=1'b0; else Q<=D;
endmodule

Below is my error log:

Code:
C:\Users\Muta\Desktop\HDL3\3-1b.v: L5: error: parse error, unexpected '[', expecting error or IDENTIFIER or HIERARCHY_IDENTIFIER or '{'
C:\Users\Muta\Desktop\HDL3\3-1b.v: L5: error: 'select' not declared

Any ideas as to where the error is?
 
Physics news on Phys.org
  • #2
Your error log seems to identify line 5 as the culprit, as it is not expecting the expression in brackets.
Code:
assign [1:0] select = {s1,s0};
Do you have any documentation for the 1995 version of Verilogger Pro? If so, does the syntax allow for bracketed expressions after an assign statement?

I don't pretend to have any knowledge whatsoever of Verilogger Pro syntax, but this is where I would start.
 
  • #3
Unfortunately, I have no documentation for that version. Our textbook brushes the topic of Verilog, lord knows why I am learning it, but it mixes both syntaxes. One minute we are reading 1995 syntax, and the next we are reading 2001, 2005.

I actually figured it out after playing around with the code long enough:

Code:
module Shift_Register_4_str (A_par, I_par, s1, s0, MSB_in, LSB_in, CLK, Clear, select);

I acutally had to initialize it in the first line of the module. Funny thing is that my initial post was how the textbook had it, so I was on my own for figuring out the errors. This really isn't the greatest textbook to learning this software.
 
  • #4
Okay, I can compile it, but I had to get ride of the [1:0] after the Assign statement. So my waveforms aren't coming out correct. They aren't doing what they are supposed to be doing.
 
  • #5
It's probably simplest to tell VeriLogger's GUI to use the new VeriLogger Extreme simulator instead of VeriLogger Pro. VeriLogger Extreme is Verilog 2001 compliant (and mostly 2005 as well). If you have an old version of VeriLogger that doesn't have Extreme, you can download a more recent one from:

http://www.syncad.com
 
  • #6
eeguy said:
It's probably simplest to tell VeriLogger's GUI to use the new VeriLogger Extreme simulator instead of VeriLogger Pro. VeriLogger Extreme is Verilog 2001 compliant (and mostly 2005 as well). If you have an old version of VeriLogger that doesn't have Extreme, you can download a more recent one from:

http://www.syncad.com

Thing is that my copy is an evaluation version from my textbook. Won't I have to pay?
 
  • #7
No, you don't have to pay. The one on the website is just a newer version of the one included in the book. Also, SynaptiCAD is actually giving away full 6-month trial licenses (which enables the stuff not turned on in the book version).
 
  • #8
Unfortunately, that copy of Verilogger doesn't help me. I tried my code and it didn't work.
 
  • #9
Yep, there's an error in the code. But the error reported by VeriLogger Extreme was fairly clear about the problem I think. Try making the following code change:

wire [1:0] select = {s1,s0};
 
  • #10
Tried that and still not working.
 

1. What is the difference between Verilogger Pro's 2001/2005 syntax and 1995 syntax?

The main difference is in the way they handle module declarations and instantiation. The 2001/2005 syntax uses the 'module' keyword for declarations and the 'instance' keyword for instantiation, while the 1995 syntax uses the 'module_name' keyword for both declarations and instantiation. Additionally, the 2001/2005 syntax allows for parameterized modules, while the 1995 syntax does not.

2. Can Verilogger Pro automatically convert code from 2001/2005 syntax to 1995 syntax?

Yes, Verilogger Pro has a built-in converter that can automatically convert code from 2001/2005 syntax to 1995 syntax. However, it is important to note that the conversion may not be 100% accurate and some manual adjustments may be necessary.

3. Are there any limitations to using the 1995 syntax in Verilogger Pro?

Yes, there are some limitations to using the 1995 syntax in Verilogger Pro. For example, you cannot use parameterized modules or the 'instance' keyword for instantiation. Additionally, some of the newer Verilog features such as 'always_comb' and 'always_ff' cannot be used with the 1995 syntax.

4. Can I still use Verilogger Pro for simulations if I only know the 1995 syntax?

Yes, you can still use Verilogger Pro for simulations even if you only know the 1995 syntax. However, you may need to manually convert your code to the 1995 syntax or use the built-in converter mentioned earlier.

5. Is it recommended to switch from 1995 syntax to 2001/2005 syntax in Verilogger Pro?

It ultimately depends on your specific needs and preferences. If you are working on a project that requires the use of parameterized modules or other features only available in the 2001/2005 syntax, it may be beneficial to switch. However, if you are comfortable with the 1995 syntax and do not need these additional features, there is no need to switch.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
1
Views
20K
  • Electrical Engineering
Replies
1
Views
7K
Back
Top