• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Custom IC Design
  3. creating a matrix of instances in verilog-A

Stats

  • Locked Locked
  • Replies 2
  • Subscribers 125
  • Views 16264
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

creating a matrix of instances in verilog-A

rickrevolta
rickrevolta over 15 years ago

Hello

I am trying to create a matrix of instances but not successfully so far. It is composed by 120 rows and 160 columns. I have to separate it in row/column even and odd. So I have 60 even and odd rows and 80 even and odd columns. I am trying to use  two for construction to instantiate the devices  between the rows and columns but I am facing some difficulties. I have to name the instances, and I tried to do it using a variable but does not work. It thinks that i am trying to use a function. The instance is a photodiode and I am nameing them by d_odd and d_even. Could you help me on that ? thanks

 

`include "constants.vams"
`include "disciplines.vams"
`include "photodiode.va"
module fpa_120_160(col_even, col_odd, row_even, row_odd);

inout [1:80] col_even;
electrical [1:80] col_even;
inout [1:80] col_odd;
electrical [1:80] col_odd;
inout [1:60] row_even;
electrical [1:60] row_even;
inout [1:60] row_odd;
electrical [1:60] row_odd;

genvar a,b;
integer c,d,k;

real i ;

analog begin
    
    @(initial_step)     begin
        
                                       k = 0;
                                       c = 1;
                                       d = 1;
                              end            
    
    for (a = 1 ; a <= 60 ; a = a + 1 )
        
        i = 0 + 1.666*k;
        
        begin
        
            for (b = 1 ; b <= 80 ; b = b + 1 )
            
                d_odd(c) (col_odd[b] row_odd[a]) photodiode intensity = i;

                c = c + 1;
            
                d_odd(c) (col_even[b] row_odd[a]) photodiode intensity = i;

                c = c + 1;
                
                
                d_even(d) (col_odd[b] row_even[a]) photodiode intensity = i;

                d = d + 1;
            
                d_even(d) (col_even[b] row_even[a]) photodiode intensity = i;
                
                d = d + 1;
        end
                
        k = k + 1;
        
    end        
                
endmodule

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 15 years ago

    You didn't say which simulator you're using. If it's AMS Designer, then this is possible - I added some `DEFINE to make it a little easier to test. The key things wrong were:

    1. You need to put the structural instantiations inside a generate block
    2. You had the syntax of the instantiations wrong
    3. You don't need to make the instances unique over the entire generate - it does that for you
    4. You can't have the assignments inside the for loops like you did - so I did the calculations on the fly on the instance lines

    Note that I don't think this is possible in spectre's VerilogA. The generate statement was the old way of doing genvars in VerilogA - but it has a different meaning than generate in VerilogAMS (I think the new generate comes from Verilog-2001).

    Anyway, here's the code I got to compile. Note I did not test this other than compiling it with "ncvlog -ams".

    `include "constants.vams"
    `include "disciplines.vams"
    //`include "photodiode.va"
    
    `define ROWSIZE 60
    `define COLSIZE 80
    
    // dummy module because I didn't have it
    module photodiode(x,y);
    inout x,y;
    electrical x,y;
    
    parameter real intensity=1.0;
    
    analog 
      V(x,y) <+ I(x,y)*intensity;
    endmodule
    
    module fpa_120_160(col_even, col_odd, row_even, row_odd);
    
    inout [1:`COLSIZE] col_even;
    electrical [1:`COLSIZE] col_even;
    inout [1:`COLSIZE] col_odd;
    electrical [1:`COLSIZE] col_odd;
    inout [1:`ROWSIZE] row_even;
    electrical [1:`ROWSIZE] row_even;
    inout [1:`ROWSIZE] row_odd;
    electrical [1:`ROWSIZE] row_odd;
    
    genvar a,b;
    
    generate
        for (a = 1 ; a <= `ROWSIZE ; a = a + 1 ) begin
    	for (b = 1 ; b <= `COLSIZE ; b = b + 1 ) begin
                    photodiode #(.intensity(1.666*((b-1)*`COLSIZE+(a-1)))) d_odd1(col_odd[b],row_odd[a]);
                    photodiode #(.intensity(1.666*((b-1)*`COLSIZE+(a-1)))) d_odd2(col_even[b],row_odd[a]);
                    photodiode #(.intensity(1.666*((b-1)*`COLSIZE+(a-1)))) d_even1(col_odd[b],row_even[a]);
                    photodiode #(.intensity(1.666*((b-1)*`COLSIZE+(a-1)))) d_even2(col_even[b],row_even[a]);
            end
        end
    endgenerate
                    
    endmodule
    

    Regards,

    Andrew.

     

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 15 years ago
    Quick reply to see whether email replies are working. Will try to answer the question properly later.

    Regards,

    Andrew.
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information