1.1 diff -r 35dc7ba83714 -r 73de224304c1 lm32_mc_arithmetic.v 1.2 --- a/lm32_mc_arithmetic.v Sun Mar 06 21:14:43 2011 +0000 1.3 +++ b/lm32_mc_arithmetic.v Sat Aug 06 00:02:46 2011 +0100 1.4 @@ -1,18 +1,39 @@ 1.5 -// ============================================================================= 1.6 -// COPYRIGHT NOTICE 1.7 -// Copyright 2006 (c) Lattice Semiconductor Corporation 1.8 -// ALL RIGHTS RESERVED 1.9 -// This confidential and proprietary software may be used only as authorised by 1.10 -// a licensing agreement from Lattice Semiconductor Corporation. 1.11 -// The entire notice above must be reproduced on all authorized copies and 1.12 -// copies may only be made to the extent permitted by a licensing agreement from 1.13 -// Lattice Semiconductor Corporation. 1.14 +// ================================================================== 1.15 +// >>>>>>>>>>>>>>>>>>>>>>> COPYRIGHT NOTICE <<<<<<<<<<<<<<<<<<<<<<<<< 1.16 +// ------------------------------------------------------------------ 1.17 +// Copyright (c) 2006-2011 by Lattice Semiconductor Corporation 1.18 +// ALL RIGHTS RESERVED 1.19 +// ------------------------------------------------------------------ 1.20 +// 1.21 +// IMPORTANT: THIS FILE IS AUTO-GENERATED BY THE LATTICEMICO SYSTEM. 1.22 +// 1.23 +// Permission: 1.24 +// 1.25 +// Lattice Semiconductor grants permission to use this code 1.26 +// pursuant to the terms of the Lattice Semiconductor Corporation 1.27 +// Open Source License Agreement. 1.28 +// 1.29 +// Disclaimer: 1.30 // 1.31 -// Lattice Semiconductor Corporation TEL : 1-800-Lattice (USA and Canada) 1.32 -// 5555 NE Moore Court 408-826-6000 (other locations) 1.33 -// Hillsboro, OR 97124 web : http://www.latticesemi.com/ 1.34 -// U.S.A email: techsupport@latticesemi.com 1.35 -// =============================================================================/ 1.36 +// Lattice Semiconductor provides no warranty regarding the use or 1.37 +// functionality of this code. It is the user's responsibility to 1.38 +// verify the user’s design for consistency and functionality through 1.39 +// the use of formal verification methods. 1.40 +// 1.41 +// -------------------------------------------------------------------- 1.42 +// 1.43 +// Lattice Semiconductor Corporation 1.44 +// 5555 NE Moore Court 1.45 +// Hillsboro, OR 97214 1.46 +// U.S.A 1.47 +// 1.48 +// TEL: 1-800-Lattice (USA and Canada) 1.49 +// 503-286-8001 (other locations) 1.50 +// 1.51 +// web: http://www.latticesemi.com/ 1.52 +// email: techsupport@latticesemi.com 1.53 +// 1.54 +// -------------------------------------------------------------------- 1.55 // FILE DETAILS 1.56 // Project : LatticeMico32 1.57 // File : lm_mc_arithmetic.v 1.58 @@ -149,59 +170,59 @@ 1.59 begin 1.60 if (rst_i == `TRUE) 1.61 begin 1.62 - cycles <= {6{1'b0}}; 1.63 - p <= {`LM32_WORD_WIDTH{1'b0}}; 1.64 - a <= {`LM32_WORD_WIDTH{1'b0}}; 1.65 - b <= {`LM32_WORD_WIDTH{1'b0}}; 1.66 + cycles <= #1 {6{1'b0}}; 1.67 + p <= #1 {`LM32_WORD_WIDTH{1'b0}}; 1.68 + a <= #1 {`LM32_WORD_WIDTH{1'b0}}; 1.69 + b <= #1 {`LM32_WORD_WIDTH{1'b0}}; 1.70 `ifdef CFG_MC_BARREL_SHIFT_ENABLED 1.71 - sign_extend_x <= 1'b0; 1.72 + sign_extend_x <= #1 1'b0; 1.73 `endif 1.74 `ifdef CFG_MC_DIVIDE_ENABLED 1.75 - divide_by_zero_x <= `FALSE; 1.76 + divide_by_zero_x <= #1 `FALSE; 1.77 `endif 1.78 - result_x <= {`LM32_WORD_WIDTH{1'b0}}; 1.79 - state <= `LM32_MC_STATE_IDLE; 1.80 + result_x <= #1 {`LM32_WORD_WIDTH{1'b0}}; 1.81 + state <= #1 `LM32_MC_STATE_IDLE; 1.82 end 1.83 else 1.84 begin 1.85 `ifdef CFG_MC_DIVIDE_ENABLED 1.86 - divide_by_zero_x <= `FALSE; 1.87 + divide_by_zero_x <= #1 `FALSE; 1.88 `endif 1.89 case (state) 1.90 `LM32_MC_STATE_IDLE: 1.91 begin 1.92 if (stall_d == `FALSE) 1.93 begin 1.94 - cycles <= `LM32_WORD_WIDTH; 1.95 - p <= 32'b0; 1.96 - a <= operand_0_d; 1.97 - b <= operand_1_d; 1.98 + cycles <= #1 `LM32_WORD_WIDTH; 1.99 + p <= #1 32'b0; 1.100 + a <= #1 operand_0_d; 1.101 + b <= #1 operand_1_d; 1.102 `ifdef CFG_MC_DIVIDE_ENABLED 1.103 if (divide_d == `TRUE) 1.104 - state <= `LM32_MC_STATE_DIVIDE; 1.105 + state <= #1 `LM32_MC_STATE_DIVIDE; 1.106 if (modulus_d == `TRUE) 1.107 - state <= `LM32_MC_STATE_MODULUS; 1.108 + state <= #1 `LM32_MC_STATE_MODULUS; 1.109 `endif 1.110 `ifdef CFG_MC_MULTIPLY_ENABLED 1.111 if (multiply_d == `TRUE) 1.112 - state <= `LM32_MC_STATE_MULTIPLY; 1.113 + state <= #1 `LM32_MC_STATE_MULTIPLY; 1.114 `endif 1.115 `ifdef CFG_MC_BARREL_SHIFT_ENABLED 1.116 if (shift_left_d == `TRUE) 1.117 begin 1.118 - state <= `LM32_MC_STATE_SHIFT_LEFT; 1.119 - sign_extend_x <= sign_extend_d; 1.120 - cycles <= operand_1_d[4:0]; 1.121 - a <= operand_0_d; 1.122 - b <= operand_0_d; 1.123 + state <= #1 `LM32_MC_STATE_SHIFT_LEFT; 1.124 + sign_extend_x <= #1 sign_extend_d; 1.125 + cycles <= #1 operand_1_d[4:0]; 1.126 + a <= #1 operand_0_d; 1.127 + b <= #1 operand_0_d; 1.128 end 1.129 if (shift_right_d == `TRUE) 1.130 begin 1.131 - state <= `LM32_MC_STATE_SHIFT_RIGHT; 1.132 - sign_extend_x <= sign_extend_d; 1.133 - cycles <= operand_1_d[4:0]; 1.134 - a <= operand_0_d; 1.135 - b <= operand_0_d; 1.136 + state <= #1 `LM32_MC_STATE_SHIFT_RIGHT; 1.137 + sign_extend_x <= #1 sign_extend_d; 1.138 + cycles <= #1 operand_1_d[4:0]; 1.139 + a <= #1 operand_0_d; 1.140 + b <= #1 operand_0_d; 1.141 end 1.142 `endif 1.143 end 1.144 @@ -211,74 +232,74 @@ 1.145 begin 1.146 if (t[32] == 1'b0) 1.147 begin 1.148 - p <= t[31:0]; 1.149 - a <= {a[`LM32_WORD_WIDTH-2:0], 1'b1}; 1.150 + p <= #1 t[31:0]; 1.151 + a <= #1 {a[`LM32_WORD_WIDTH-2:0], 1'b1}; 1.152 end 1.153 else 1.154 begin 1.155 - p <= {p[`LM32_WORD_WIDTH-2:0], a[`LM32_WORD_WIDTH-1]}; 1.156 - a <= {a[`LM32_WORD_WIDTH-2:0], 1'b0}; 1.157 + p <= #1 {p[`LM32_WORD_WIDTH-2:0], a[`LM32_WORD_WIDTH-1]}; 1.158 + a <= #1 {a[`LM32_WORD_WIDTH-2:0], 1'b0}; 1.159 end 1.160 - result_x <= a; 1.161 + result_x <= #1 a; 1.162 if ((cycles == `LM32_WORD_WIDTH'd0) || (kill_x == `TRUE)) 1.163 begin 1.164 // Check for divide by zero 1.165 - divide_by_zero_x <= b == {`LM32_WORD_WIDTH{1'b0}}; 1.166 - state <= `LM32_MC_STATE_IDLE; 1.167 + divide_by_zero_x <= #1 b == {`LM32_WORD_WIDTH{1'b0}}; 1.168 + state <= #1 `LM32_MC_STATE_IDLE; 1.169 end 1.170 - cycles <= cycles - 1'b1; 1.171 + cycles <= #1 cycles - 1'b1; 1.172 end 1.173 `LM32_MC_STATE_MODULUS: 1.174 begin 1.175 if (t[32] == 1'b0) 1.176 begin 1.177 - p <= t[31:0]; 1.178 - a <= {a[`LM32_WORD_WIDTH-2:0], 1'b1}; 1.179 + p <= #1 t[31:0]; 1.180 + a <= #1 {a[`LM32_WORD_WIDTH-2:0], 1'b1}; 1.181 end 1.182 else 1.183 begin 1.184 - p <= {p[`LM32_WORD_WIDTH-2:0], a[`LM32_WORD_WIDTH-1]}; 1.185 - a <= {a[`LM32_WORD_WIDTH-2:0], 1'b0}; 1.186 + p <= #1 {p[`LM32_WORD_WIDTH-2:0], a[`LM32_WORD_WIDTH-1]}; 1.187 + a <= #1 {a[`LM32_WORD_WIDTH-2:0], 1'b0}; 1.188 end 1.189 - result_x <= p; 1.190 + result_x <= #1 p; 1.191 if ((cycles == `LM32_WORD_WIDTH'd0) || (kill_x == `TRUE)) 1.192 begin 1.193 // Check for divide by zero 1.194 - divide_by_zero_x <= b == {`LM32_WORD_WIDTH{1'b0}}; 1.195 - state <= `LM32_MC_STATE_IDLE; 1.196 + divide_by_zero_x <= #1 b == {`LM32_WORD_WIDTH{1'b0}}; 1.197 + state <= #1 `LM32_MC_STATE_IDLE; 1.198 end 1.199 - cycles <= cycles - 1'b1; 1.200 + cycles <= #1 cycles - 1'b1; 1.201 end 1.202 `endif 1.203 `ifdef CFG_MC_MULTIPLY_ENABLED 1.204 `LM32_MC_STATE_MULTIPLY: 1.205 begin 1.206 if (b[0] == 1'b1) 1.207 - p <= p + a; 1.208 - b <= {1'b0, b[`LM32_WORD_WIDTH-1:1]}; 1.209 - a <= {a[`LM32_WORD_WIDTH-2:0], 1'b0}; 1.210 - result_x <= p; 1.211 + p <= #1 p + a; 1.212 + b <= #1 {1'b0, b[`LM32_WORD_WIDTH-1:1]}; 1.213 + a <= #1 {a[`LM32_WORD_WIDTH-2:0], 1'b0}; 1.214 + result_x <= #1 p; 1.215 if ((cycles == `LM32_WORD_WIDTH'd0) || (kill_x == `TRUE)) 1.216 - state <= `LM32_MC_STATE_IDLE; 1.217 - cycles <= cycles - 1'b1; 1.218 + state <= #1 `LM32_MC_STATE_IDLE; 1.219 + cycles <= #1 cycles - 1'b1; 1.220 end 1.221 `endif 1.222 `ifdef CFG_MC_BARREL_SHIFT_ENABLED 1.223 `LM32_MC_STATE_SHIFT_LEFT: 1.224 begin 1.225 - a <= {a[`LM32_WORD_WIDTH-2:0], 1'b0}; 1.226 - result_x <= a; 1.227 + a <= #1 {a[`LM32_WORD_WIDTH-2:0], 1'b0}; 1.228 + result_x <= #1 a; 1.229 if ((cycles == `LM32_WORD_WIDTH'd0) || (kill_x == `TRUE)) 1.230 - state <= `LM32_MC_STATE_IDLE; 1.231 - cycles <= cycles - 1'b1; 1.232 + state <= #1 `LM32_MC_STATE_IDLE; 1.233 + cycles <= #1 cycles - 1'b1; 1.234 end 1.235 `LM32_MC_STATE_SHIFT_RIGHT: 1.236 begin 1.237 - b <= {fill_value, b[`LM32_WORD_WIDTH-1:1]}; 1.238 - result_x <= b; 1.239 + b <= #1 {fill_value, b[`LM32_WORD_WIDTH-1:1]}; 1.240 + result_x <= #1 b; 1.241 if ((cycles == `LM32_WORD_WIDTH'd0) || (kill_x == `TRUE)) 1.242 - state <= `LM32_MC_STATE_IDLE; 1.243 - cycles <= cycles - 1'b1; 1.244 + state <= #1 `LM32_MC_STATE_IDLE; 1.245 + cycles <= #1 cycles - 1'b1; 1.246 end 1.247 `endif 1.248 endcase