OpenCores
URL https://opencores.org/ocsvn/an-fpga-implementation-of-low-latency-noc-based-mpsoc/an-fpga-implementation-of-low-latency-noc-based-mpsoc/trunk

Subversion Repositories an-fpga-implementation-of-low-latency-noc-based-mpsoc

[/] [an-fpga-implementation-of-low-latency-noc-based-mpsoc/] [trunk/] [mpsoc/] [src_processor/] [lm32/] [verilog/] [src/] [lm32_addsub.v] - Blame information for rev 17

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 17 alirezamon
// =============================================================================
2
//                           COPYRIGHT NOTICE
3
// Copyright 2006 (c) Lattice Semiconductor Corporation
4
// ALL RIGHTS RESERVED
5
// This confidential and proprietary software may be used only as authorised by
6
// a licensing agreement from Lattice Semiconductor Corporation.
7
// The entire notice above must be reproduced on all authorized copies and
8
// copies may only be made to the extent permitted by a licensing agreement from
9
// Lattice Semiconductor Corporation.
10
//
11
// Lattice Semiconductor Corporation        TEL : 1-800-Lattice (USA and Canada)
12
// 5555 NE Moore Court                            408-826-6000 (other locations)
13
// Hillsboro, OR 97124                     web  : http://www.latticesemi.com/
14
// U.S.A                                   email: techsupport@latticesemi.com
15
// =============================================================================/
16
//                         FILE DETAILS
17
// Project          : LatticeMico32
18
// File             : lm32_addsub.v
19
// Title            : PMI adder/subtractor.
20
// Version          : 6.1.17
21
// =============================================================================
22
 
23
`include "lm32_include.v"
24
 
25
/////////////////////////////////////////////////////
26
// Module interface
27
/////////////////////////////////////////////////////
28
 
29
module lm32_addsub (
30
    // ----- Inputs -------
31
    DataA,
32
    DataB,
33
    Cin,
34
    Add_Sub,
35
    // ----- Outputs -------
36
    Result,
37
    Cout
38
    );
39
 
40
/////////////////////////////////////////////////////
41
// Inputs
42
/////////////////////////////////////////////////////
43
 
44
input [31:0] DataA;
45
input [31:0] DataB;
46
input Cin;
47
input Add_Sub;
48
 
49
/////////////////////////////////////////////////////
50
// Outputs
51
/////////////////////////////////////////////////////
52
 
53
output [31:0] Result;
54
wire   [31:0] Result;
55
output Cout;
56
wire   Cout;
57
 
58
/////////////////////////////////////////////////////
59
// Instantiations
60
///////////////////////////////////////////////////// 
61
 
62
             wire [32:0] tmp_addResult = DataA + DataB + Cin;
63
             wire [32:0] tmp_subResult = DataA - DataB - !Cin;
64
 
65
             assign  Result = (Add_Sub == 1) ? tmp_addResult[31:0] : tmp_subResult[31:0];
66
             assign  Cout = (Add_Sub == 1) ? tmp_addResult[32] : !tmp_subResult[32];
67
 
68
 
69
endmodule

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.