Code Completetion

Get help with the installation and running of the Zeus IDE. Please do not post bug reports or feature requests here. When in doubt post your question here.
Post Reply
emh203@psu.edu

Code Completetion

Post by emh203@psu.edu »

Hello:

I am trying to use the code completion option. I have setup of definition for a verilog file type. When I put in my verilog code into a work space, I notice that variable names show up in the class browers under interface, typedefs, etc.

How exact do I make the code completion work? when I type part of a variable name and place a period it does not try to complete the variable name.

What is a simple way to check that I have eveything setup correctly?

Thanks,
Eli Hughes
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij »

At it's simplest the code completion is driven by the data contained in the class browser and is the triggered by the ., -> and ( characters, so for code completion to trigger the item must be defined in the class browser and one of these characters entered.

But there is also a case where things are indirectly defined in the class browser for example:

Code: Select all

SomeVariable  val;
val.
In this case although the variable val is not defined, it should still code complete, provided the SomeVariable is defined. In these indirect cases, the parsing required to define the variable type is done internally by Zeus.

Finally the code completion is totally reliant on what is in the class browser and this comes down to the information produced by ctags produces and how well Zeus interprets the tag file.

As you can see there are lots of places for the code completion to go wrong and as such it is difficult to give a simple answer as to what needs to be done to make it work :(

But if you where to post a very simple piece of sample Verilog code with one or two variables defined and a small snippet of code on how you would expect these variables to code complete, it would be very easy for me to determine why the completion is not working.

Also make sure you quote the file extension you save the code under as ctags will generate it's tags information based on file extension.

Cheers Jussi
emh203@psu.edu

Verilog Code Completion example

Post by emh203@psu.edu »

Here is an simple verilog example. Look below the code for a short description of how I think the code completion should operate

*****************************************
module Eli( Clk , Enable, CountOut)

input Clk;
input Enable;
output [7:0] Output;

parameter MaxCount = 8'h99;

reg [7:0] MyCounter;

always @(posedge Clk)
begin

if(Enable == 1)
begin
if(MyCounter == MaxCount)
MyCounter <= 0;
else
MyCounter <= MyCounter + 1;
end
else
MyCounter <= 0;

end

assign CountOut = MyCount;

********************************************

Ok, that was an example of a program. There are a couple of different 'types' that it would be nice for the code completion to recognize.

1.)

At the top of the code there are statements that describe the I/O ports of the module
input Clk;
input Enable;
output [7:0] Output;

although not shown, there is another keyword used called 'inout'

2.)
Right below the input/output port declarations is a parameter. A parameter is very similiar to a #define statement in C

parameter MaxCount = 8'h99;

3.) After the parameter declaration, there is a reg type declared. A reg is similar to a variable in that it can (but not always!) imply some kind of storage.

reg [7:0] MyCounter;

Based upon the code above, I would expect the code completion to be able to complete any of these keywords/variables in the code:


Clk
Enable
Output
MaxCount
MyCounter


Now, there are some other keywords that would be nice to recognize, but lets start with this. If there is anything I can do to make this go faster for you, let me know. I really appreciate all the help. This editor will be mighty fine when the code completion works (as well as the code folding which you so graciously addressed already!) for verilog!
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij »

Hi Eli,
Based upon the code above, I would expect the code completion to be able to complete any of these keywords/variables in the code:

Form what you describe I assume that when you type the letters:

Code: Select all

Ma
Zeus auto completes this to:

Code: Select all

MaxCount
Unfortunately this the type of code completion, auto completion feature is not currently supported :(

It would definitely be a nice feature to have and hopefully something like this will eventually make it's way into Zeus, but at present the only things that triggers code completion are the ., -> and ( characters.

Jussi
Post Reply