lm32_mc_arithmetic.v

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