lm32_addsub.v

changeset 24
c336e674a37e
parent 23
252df75c8f67
child 25
7422134cbfea
     1.1 --- a/lm32_addsub.v	Sun Mar 06 21:17:31 2011 +0000
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,98 +0,0 @@
     1.4 -// =============================================================================
     1.5 -//                           COPYRIGHT NOTICE
     1.6 -// Copyright 2006 (c) Lattice Semiconductor Corporation
     1.7 -// ALL RIGHTS RESERVED
     1.8 -// This confidential and proprietary software may be used only as authorised by
     1.9 -// a licensing agreement from Lattice Semiconductor Corporation.
    1.10 -// The entire notice above must be reproduced on all authorized copies and
    1.11 -// copies may only be made to the extent permitted by a licensing agreement from
    1.12 -// Lattice Semiconductor Corporation.
    1.13 -//
    1.14 -// Lattice Semiconductor Corporation        TEL : 1-800-Lattice (USA and Canada)
    1.15 -// 5555 NE Moore Court                            408-826-6000 (other locations)
    1.16 -// Hillsboro, OR 97124                     web  : http://www.latticesemi.com/
    1.17 -// U.S.A                                   email: techsupport@latticesemi.com
    1.18 -// =============================================================================/
    1.19 -//                         FILE DETAILS
    1.20 -// Project          : LatticeMico32
    1.21 -// File             : lm32_addsub.v
    1.22 -// Title            : PMI adder/subtractor.
    1.23 -// Version          : 6.1.17
    1.24 -//                  : Initial Release
    1.25 -// Version          : 7.0SP2, 3.0
    1.26 -//                  : No Change
    1.27 -// Version          : 3.1
    1.28 -//                  : No Change
    1.29 -// =============================================================================
    1.30 -
    1.31 -`include "lm32_include.v"
    1.32 -
    1.33 -/////////////////////////////////////////////////////
    1.34 -// Module interface
    1.35 -/////////////////////////////////////////////////////
    1.36 -
    1.37 -module lm32_addsub (
    1.38 -    // ----- Inputs -------
    1.39 -    DataA, 
    1.40 -    DataB, 
    1.41 -    Cin, 
    1.42 -    Add_Sub, 
    1.43 -    // ----- Outputs -------
    1.44 -    Result, 
    1.45 -    Cout
    1.46 -    );
    1.47 -
    1.48 -/////////////////////////////////////////////////////
    1.49 -// Inputs
    1.50 -/////////////////////////////////////////////////////
    1.51 -
    1.52 -input [31:0] DataA;
    1.53 -input [31:0] DataB;
    1.54 -input Cin;
    1.55 -input Add_Sub;
    1.56 -
    1.57 -/////////////////////////////////////////////////////
    1.58 -// Outputs
    1.59 -/////////////////////////////////////////////////////
    1.60 -
    1.61 -output [31:0] Result;
    1.62 -wire   [31:0] Result;
    1.63 -output Cout;
    1.64 -wire   Cout;
    1.65 -
    1.66 -/////////////////////////////////////////////////////
    1.67 -// Instantiations
    1.68 -///////////////////////////////////////////////////// 
    1.69 -
    1.70 -// Only use Lattice specific constructs when compiling with ispLEVER
    1.71 -`ifdef PLATFORM_LATTICE
    1.72 -       generate
    1.73 -	  if (`LATTICE_FAMILY == "SC" || `LATTICE_FAMILY == "SCM") begin
    1.74 -`endif
    1.75 -	     wire [32:0] tmp_addResult = DataA + DataB + Cin;
    1.76 -	     wire [32:0] tmp_subResult = DataA - DataB - !Cin;   
    1.77 -   
    1.78 -	     assign  Result = (Add_Sub == 1) ? tmp_addResult[31:0] : tmp_subResult[31:0];
    1.79 -	     assign  Cout = (Add_Sub == 1) ? tmp_addResult[32] : !tmp_subResult[32];
    1.80 -`ifdef PLATFORM_LATTICE
    1.81 -	  end else begin
    1.82 -	    pmi_addsub #(// ----- Parameters -------
    1.83 -			 .pmi_data_width     (32),
    1.84 -			 .pmi_result_width   (32),
    1.85 -			 .pmi_sign           ("off"),
    1.86 -			 .pmi_family         (`LATTICE_FAMILY),
    1.87 -			 .module_type        ("pmi_addsub")) 
    1.88 -	      addsub    (// ----- Inputs -------
    1.89 -			 .DataA              (DataA),
    1.90 -			 .DataB              (DataB),
    1.91 -			 .Cin                (Cin),
    1.92 -			 .Add_Sub            (Add_Sub),
    1.93 -			 // ----- Outputs -------
    1.94 -			 .Result             (Result),
    1.95 -			 .Cout               (Cout),
    1.96 -			 .Overflow           ());
    1.97 -	  end
    1.98 -       endgenerate 
    1.99 -`endif
   1.100 -
   1.101 -endmodule