/* * $Header: /projects/raw/cvsroot/benchmark/suites/jacobi/src/generate.c,v 1.5 1997/08/09 05:57:39 jbabb Exp $ * * Generate for Jacobi benchmark * * Authors: Jonathan Babb (jbabb@lcs.mit.edu) * * Copyright @ 1997 MIT Laboratory for Computer Science, Cambridge, MA 02129 */ #include #include #include #include /* This program is the topology generator for the top level verilog module (main) for this benchmark. It supports a parameterized generation of instantiations of library components. */ /* Generate is written specifically for this benchmark. It calls the following include.c routines: generateHeader - outputs what goes at the top of the main module generateTrailer - outputs what goes at the bottom of the main module wire - outputs a wire declaration instantiate - outputs instantiation of a particular library component */ void generate(int sizex, int sizey, int width, int iter, int scan) { int i,j,k,boundary,msb,lsb,cwidth,id=0,idfirst=0,idlast,id1; int idwidth,controlid,scanid=0; #ifdef NO_TEMPLATES char parameters[MAXLEN]; #else vtemplate_t node_template, control_template; #endif char name[MAXLEN]; char iname[MAXLEN]; char connections[MAXLEN]; char s[MAXLEN]; /* generate the generic header */ generateHeader(); #ifndef NO_TEMPLATES /* a Jacobi_Node has parameters named WIDTH, IDWIDTH, BOUNDARY, SCAN * (see module Jacobi_Node in library.v) */ node_template = declareTemplate("Jacobi_Node", 4, "WIDTH", "IDWIDTH", "BOUNDARY", "SCAN"); /* a Jacobi_Control parameters named WIDTH, CWIDTH, IDWIDTH, SCAN. */ control_template = declareTemplate("Jacobi_Control", 4, "WIDTH", "CWIDTH", "IDWIDTH","SCAN"); #endif /* max width of iteration counter */ cwidth=int_log(iter+1); /* width of node identifier */ idwidth = scan ? 1 : int_log(sizex*sizey)+1; /* control node address */ controlid = 1 << (idwidth-1); /* here are all the wires I'm going to use (wires must come first) */ idlast=ref(sizex-1,sizey-1)+1; for(i=0;i \n"); printf("\n"); printf("sizex is X dimension of Jacobi grid\n"); printf("sizey is Y dimension of Jacobi grid\n"); printf("width is data width of Jacobi elements (4 to 32)\n"); printf("iter is the maximum number of iterations\n"); printf("scan = scan or bus, for respective implementations\n"); printf("\n"); exit(-1); }; sizex=atoi(argv[1]); sizey=atoi(argv[2]); width=atoi(argv[3]); iter =atoi(argv[4]); scan =(strcmp(argv[5],"scan") == 0); /* 0 for bus, 1 for scan */ /* generate the computation structure */ generate(sizex,sizey,width,iter,scan); exit(0); }