Sun, 06 Mar 2011 19:48:34 +0000
Add JTAG interface for Xilinx Spartan 6 (Michael Walle)
Original-Source: Milkymist mailing list posting, 2010-09-23
Original-Message-Id: <201009232334.04219.michael@walle.cc>
Original-Author: Michael Walle <michael walle.cc>
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 |