Advertisement
Guest User

signext_genpat

a guest
Jul 23rd, 2014
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.09 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include "genpat.h"
  4.  
  5. char* inttostr(int num) {
  6.   char *str;
  7.   str = (char *) malloc (32 * sizeof (char));
  8.   sprintf (str, "%d", num);
  9.   return(str);
  10. }
  11.  
  12. main(){
  13.  
  14.     int cur_vect = 0;
  15.  
  16.     DEF_GENPAT("signext_genpat");
  17.  
  18.     //endereΓ§o de entrada
  19.     DECLAR("a", ":2", "X", IN , "15 down to 0" , "");
  20.     DECLAR("y", ":2", "X", OUT, "31 down to 0", "");
  21.  
  22.     DECLAR("vdd", ":2", "B", IN , "", "" );
  23.         DECLAR("vss", ":2", "B", IN , "", "" );
  24.  
  25.      AFFECT ("0", "vdd", "0b1");
  26.          AFFECT ("0", "vss", "0b0");
  27.  
  28.  
  29.      AFFECT ("0", "a", "0");
  30.          AFFECT ("0", "y", "0");
  31.  
  32.     //teste de sinal
  33.    
  34.     cur_vect++;
  35.     AFFECT (inttostr(cur_vect), "a","0x0000");
  36.     AFFECT (inttostr(cur_vect), "y" ,"0x00000000");
  37.  
  38.     cur_vect++;
  39.     AFFECT (inttostr(cur_vect), "a" ,"0x0FA0");
  40.     AFFECT (inttostr(cur_vect), "y" ,"0x00000FA0");
  41.    
  42.     cur_vect++;
  43.  
  44.     AFFECT (inttostr(cur_vect), "a" ,"0xFA10");
  45.     AFFECT (inttostr(cur_vect), "y" ,"0xFFFFFA10");
  46.    
  47.     cur_vect++;
  48.     AFFECT (inttostr(cur_vect), "a" ,"0XFFFF");
  49.     AFFECT (inttostr(cur_vect), "y" ,"0XFFFFFFFF");
  50.  
  51. SAV_GENPAT ();
  52.  
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement