lm32_addsub.v

Sat, 06 Aug 2011 01:26:56 +0100

author
Philip Pemberton <philpem@philpem.me.uk>
date
Sat, 06 Aug 2011 01:26:56 +0100
changeset 27
d6c693415d59
parent 26
73de224304c1
permissions
-rwxr-xr-x

remove synthesis delay entities to ease merge

     1 //   ==================================================================
     2 //   >>>>>>>>>>>>>>>>>>>>>>> COPYRIGHT NOTICE <<<<<<<<<<<<<<<<<<<<<<<<<
     3 //   ------------------------------------------------------------------
     4 //   Copyright (c) 2006-2011 by Lattice Semiconductor Corporation
     5 //   ALL RIGHTS RESERVED 
     6 //   ------------------------------------------------------------------
     7 //
     8 //   IMPORTANT: THIS FILE IS AUTO-GENERATED BY THE LATTICEMICO SYSTEM.
     9 //
    10 //   Permission:
    11 //
    12 //      Lattice Semiconductor grants permission to use this code
    13 //      pursuant to the terms of the Lattice Semiconductor Corporation
    14 //      Open Source License Agreement.  
    15 //
    16 //   Disclaimer:
    17 //
    18 //      Lattice Semiconductor provides no warranty regarding the use or
    19 //      functionality of this code. It is the user's responsibility to
    20 //      verify the userís design for consistency and functionality through
    21 //      the use of formal verification methods.
    22 //
    23 //   --------------------------------------------------------------------
    24 //
    25 //                  Lattice Semiconductor Corporation
    26 //                  5555 NE Moore Court
    27 //                  Hillsboro, OR 97214
    28 //                  U.S.A
    29 //
    30 //                  TEL: 1-800-Lattice (USA and Canada)
    31 //                         503-286-8001 (other locations)
    32 //
    33 //                  web: http://www.latticesemi.com/
    34 //                  email: techsupport@latticesemi.com
    35 //
    36 //   --------------------------------------------------------------------
    37 //                         FILE DETAILS
    38 // Project          : LatticeMico32
    39 // File             : lm32_addsub.v
    40 // Title            : PMI adder/subtractor.
    41 // Version          : 6.1.17
    42 //                  : Initial Release
    43 // Version          : 7.0SP2, 3.0
    44 //                  : No Change
    45 // Version          : 3.1
    46 //                  : No Change
    47 // =============================================================================
    49 `include "lm32_include.v"
    51 /////////////////////////////////////////////////////
    52 // Module interface
    53 /////////////////////////////////////////////////////
    55 module lm32_addsub (
    56     // ----- Inputs -------
    57     DataA, 
    58     DataB, 
    59     Cin, 
    60     Add_Sub, 
    61     // ----- Outputs -------
    62     Result, 
    63     Cout
    64     );
    66 /////////////////////////////////////////////////////
    67 // Inputs
    68 /////////////////////////////////////////////////////
    70 input [31:0] DataA;
    71 input [31:0] DataB;
    72 input Cin;
    73 input Add_Sub;
    75 /////////////////////////////////////////////////////
    76 // Outputs
    77 /////////////////////////////////////////////////////
    79 output [31:0] Result;
    80 wire   [31:0] Result;
    81 output Cout;
    82 wire   Cout;
    84 /////////////////////////////////////////////////////
    85 // Instantiations
    86 ///////////////////////////////////////////////////// 
    88        generate
    89 	  if (`LATTICE_FAMILY == "SC" || `LATTICE_FAMILY == "SCM") begin
    90 	     wire [32:0] tmp_addResult = DataA + DataB + Cin;
    91 	     wire [32:0] tmp_subResult = DataA - DataB - !Cin;   
    93 	     assign  Result = (Add_Sub == 1) ? tmp_addResult[31:0] : tmp_subResult[31:0];
    94 	     assign  Cout = (Add_Sub == 1) ? tmp_addResult[32] : !tmp_subResult[32];
    95 	  end else begin
    96 	    pmi_addsub #(// ----- Parameters -------
    97 			 .pmi_data_width     (32),
    98 			 .pmi_result_width   (32),
    99 			 .pmi_sign           ("off"),
   100 			 .pmi_family         (`LATTICE_FAMILY),
   101 			 .module_type        ("pmi_addsub")) 
   102 	      addsub    (// ----- Inputs -------
   103 			 .DataA              (DataA),
   104 			 .DataB              (DataB),
   105 			 .Cin                (Cin),
   106 			 .Add_Sub            (Add_Sub),
   107 			 // ----- Outputs -------
   108 			 .Result             (Result),
   109 			 .Cout               (Cout),
   110 			 .Overflow           ());
   111 	  end
   112        endgenerate 
   114 endmodule