1 // ==================================================================
2 // >>>>>>>>>>>>>>>>>>>>>>> COPYRIGHT NOTICE <<<<<<<<<<<<<<<<<<<<<<<<<
3 // ------------------------------------------------------------------
4 // Copyright (c) 2006-2011 by Lattice Semiconductor Corporation
6 // ------------------------------------------------------------------
8 // IMPORTANT: THIS FILE IS AUTO-GENERATED BY THE LATTICEMICO SYSTEM.
12 // Lattice Semiconductor grants permission to use this code
13 // pursuant to the terms of the Lattice Semiconductor Corporation
14 // Open Source License Agreement.
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.
23 // --------------------------------------------------------------------
25 // Lattice Semiconductor Corporation
26 // 5555 NE Moore Court
27 // Hillsboro, OR 97214
30 // TEL: 1-800-Lattice (USA and Canada)
31 // 503-286-8001 (other locations)
33 // web: http://www.latticesemi.com/
34 // email: techsupport@latticesemi.com
36 // --------------------------------------------------------------------
38 // Project : LatticeMico32
39 // File : lm32_addsub.v
40 // Title : PMI adder/subtractor.
43 // Version : 7.0SP2, 3.0
47 // =============================================================================
49 `include "lm32_include.v"
51 /////////////////////////////////////////////////////
53 /////////////////////////////////////////////////////
56 // ----- Inputs -------
61 // ----- Outputs -------
66 /////////////////////////////////////////////////////
68 /////////////////////////////////////////////////////
75 /////////////////////////////////////////////////////
77 /////////////////////////////////////////////////////
84 /////////////////////////////////////////////////////
86 /////////////////////////////////////////////////////
88 // Modified for Milkymist: removed non-portable instantiated block
89 wire [32:0] tmp_addResult = DataA + DataB + Cin;
90 wire [32:0] tmp_subResult = DataA - DataB - !Cin;
92 assign Result = (Add_Sub == 1) ? tmp_addResult[31:0] : tmp_subResult[31:0];
93 assign Cout = (Add_Sub == 1) ? tmp_addResult[32] : !tmp_subResult[32];