Sat, 06 Aug 2011 00:02:46 +0100
[UPSTREAM PULL] Update baseline to LatticeMico32 v3.8 from Diamond 1.3-lm32 distribution package (datestamp May 2011)
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_multiplier.v
40 // Title : Pipelined multiplier.
41 // Dependencies : lm32_include.v
42 // Version : 6.1.17
43 // : Initial Release
44 // Version : 7.0SP2, 3.0
45 // : No Change
46 // Version : 3.1
47 // : No Change
48 // =============================================================================
50 `include "lm32_include.v"
52 /////////////////////////////////////////////////////
53 // Module interface
54 /////////////////////////////////////////////////////
56 module lm32_multiplier (
57 // ----- Inputs -----
58 clk_i,
59 rst_i,
60 stall_x,
61 stall_m,
62 operand_0,
63 operand_1,
64 // ----- Ouputs -----
65 result
66 );
68 /////////////////////////////////////////////////////
69 // Inputs
70 /////////////////////////////////////////////////////
72 input clk_i; // Clock
73 input rst_i; // Reset
74 input stall_x; // Stall instruction in X stage
75 input stall_m; // Stall instruction in M stage
76 input [`LM32_WORD_RNG] operand_0; // Muliplicand
77 input [`LM32_WORD_RNG] operand_1; // Multiplier
79 /////////////////////////////////////////////////////
80 // Outputs
81 /////////////////////////////////////////////////////
83 output [`LM32_WORD_RNG] result; // Product of multiplication
84 reg [`LM32_WORD_RNG] result;
86 /////////////////////////////////////////////////////
87 // Internal nets and registers
88 /////////////////////////////////////////////////////
90 reg [`LM32_WORD_RNG] muliplicand;
91 reg [`LM32_WORD_RNG] multiplier;
92 reg [`LM32_WORD_RNG] product;
94 /////////////////////////////////////////////////////
95 // Sequential logic
96 /////////////////////////////////////////////////////
98 always @(posedge clk_i `CFG_RESET_SENSITIVITY)
99 begin
100 if (rst_i == `TRUE)
101 begin
102 muliplicand <= #1 {`LM32_WORD_WIDTH{1'b0}};
103 multiplier <= #1 {`LM32_WORD_WIDTH{1'b0}};
104 product <= #1 {`LM32_WORD_WIDTH{1'b0}};
105 result <= #1 {`LM32_WORD_WIDTH{1'b0}};
106 end
107 else
108 begin
109 if (stall_x == `FALSE)
110 begin
111 muliplicand <= #1 operand_0;
112 multiplier <= #1 operand_1;
113 end
114 if (stall_m == `FALSE)
115 product <= #1 muliplicand * multiplier;
116 result <= #1 product;
117 end
118 end
120 endmodule