lm32_functions.v

Mon, 05 Apr 2010 21:00:31 +0100

author
Philip Pemberton <philpem@philpem.me.uk>
date
Mon, 05 Apr 2010 21:00:31 +0100
changeset 6
a8e459b24c31
parent 0
cd0b58aa6f83
child 26
73de224304c1
permissions
-rw-r--r--

reduce size of caches to fit in DE1 FPGA

The default cache size makes the Icache and Dcache "just a bit" too big to
fit in the EP2C20 FPGA on the DE1 board. This commit reduces the Icache and
Dcache sizes to the defaults shown in the LatticeMico32 Processor Reference
Manual (pages 36 and 37).

philpem@0 1 // =============================================================================
philpem@0 2 // COPYRIGHT NOTICE
philpem@0 3 // Copyright 2006 (c) Lattice Semiconductor Corporation
philpem@0 4 // ALL RIGHTS RESERVED
philpem@0 5 // This confidential and proprietary software may be used only as authorised by
philpem@0 6 // a licensing agreement from Lattice Semiconductor Corporation.
philpem@0 7 // The entire notice above must be reproduced on all authorized copies and
philpem@0 8 // copies may only be made to the extent permitted by a licensing agreement from
philpem@0 9 // Lattice Semiconductor Corporation.
philpem@0 10 //
philpem@0 11 // Lattice Semiconductor Corporation TEL : 1-800-Lattice (USA and Canada)
philpem@0 12 // 5555 NE Moore Court 408-826-6000 (other locations)
philpem@0 13 // Hillsboro, OR 97124 web : http://www.latticesemi.com/
philpem@0 14 // U.S.A email: techsupport@latticesemi.com
philpem@0 15 // =============================================================================/
philpem@0 16 // FILE DETAILS
philpem@0 17 // Project : LatticeMico32
philpem@0 18 // File : lm32_functions.v
philpem@0 19 // Title : Common functions
philpem@0 20 // Version : 6.1.17
philpem@0 21 // : Initial Release
philpem@0 22 // Version : 7.0SP2, 3.0
philpem@0 23 // : No Change
philpem@0 24 // Version : 3.5
philpem@0 25 // : Added function to generate log-of-two that rounds-up to
philpem@0 26 // : power-of-two
philpem@0 27 // =============================================================================
philpem@0 28
philpem@0 29 function integer clogb2;
philpem@0 30 input [31:0] value;
philpem@0 31 begin
philpem@0 32 for (clogb2 = 0; value > 0; clogb2 = clogb2 + 1)
philpem@0 33 value = value >> 1;
philpem@0 34 end
philpem@0 35 endfunction
philpem@0 36
philpem@0 37 function integer clogb2_v1;
philpem@0 38 input [31:0] value;
philpem@0 39 reg [31:0] i;
philpem@0 40 reg [31:0] temp;
philpem@0 41 begin
philpem@0 42 temp = 0;
philpem@0 43 i = 0;
philpem@0 44 for (i = 0; temp < value; i = i + 1)
philpem@0 45 temp = 1<<i;
philpem@0 46 clogb2_v1 = i-1;
philpem@0 47 end
philpem@0 48 endfunction
philpem@0 49