LOGIN   :::   RECOVER PASS   :::   GET ACCOUNT    
Browse
  • Projects
  • Code (CVS)
  • Forums
  • News
  • Articles
  • Polls
  •  
    OpenCores
  • FAQ
  • CVS HowTo
  • Mission
  • Media
  • Tools
  • Advertise
  • Mirrors
  • Logos
  • Contact us
  • Find Resources
  • Job Opportunity
  •  
    Tools
  • Search
      
  • Download Cores (CVSGet)
  •  
    More
  • Wishbone
  • Perlilog
  • EDA tools
  • OpenTech CD
  •  
    Navigation: All forums > Cores > Message List > Message Post

    Message

    Reply | Reply all
    Date Prev | Date Next | Thread Prev | Thread Next Date Index | Thread Index

    From: Guy Hutchison<ghutchis@g...>
    Date: Tue Dec 21 19:28:53 CET 2004
    Subject: [oc] Dealing with large vectors in Verilog
    Top
    The answer depends somewhat on whether you want the reuslt to be
    synthesizable. The easiest way is to simply access the elements by
    bit-slice:

    reg [351:0] tmp;

    tmp = MEMA[p];
    result = tmp[(j+1)*16-1:j*16] + tmp[(k+1)*16-1:k*16];

    However, some simulators and most synthesis tools will not accept this
    syntax. Shift notation is less intuitive but works better with the
    language:

    reg [15:0] tmpa, tmpb;
    mpa = MEMA[p] >> (j*16);
    tmpb = MEMA[p] >> (k*16);
    result = tmpa + tmpb;

    For synthesis, this might generate acceptable results, but for
    hardware it would be better to explicitly declare the two 22:1 muxes
    and add the results.

    - Guy

    ReferenceAuthor
    [oc] Dealing with large vectors in VerilogAshim

    Follow upAuthor
    [oc] Dealing with large vectors in VerilogGunnard

     
    Copyright (c) 1999 OPENCORES.ORG. All rights reserved.