1!! Copyright (C) 2008 X. Andrade 2!! 3!! This program is free software; you can redistribute it and/or modify 4!! it under the terms of the GNU General Public License as published by 5!! the Free Software Foundation; either version 2, or (at your option) 6!! any later version. 7!! 8!! This program is distributed in the hope that it will be useful, 9!! but WITHOUT ANY WARRANTY; without even the implied warranty of 10!! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11!! GNU General Public License for more details. 12!! 13!! You should have received a copy of the GNU General Public License 14!! along with this program; if not, write to the Free Software 15!! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 16!! 02110-1301, USA. 17!! 18 19#include "global.h" 20module hardware_oct_m 21 22 implicit none 23 24 private 25 public :: & 26 hardware, & 27 cache_t, & 28 hardware_t, & 29 hardware_init, & 30 hardware_end 31 32 type cache_t 33 ! Components are public by default 34 integer :: size 35 integer :: line_size 36 end type cache_t 37 38 type hardware_t 39 ! Components are public by default 40 type(cache_t) :: l1 41 type(cache_t) :: l2 42 integer :: dblock_size 43 integer :: zblock_size 44 end type hardware_t 45 46 type(hardware_t) :: hardware 47 48contains 49 50 subroutine hardware_init 51 52 !for the moment we will use fixed values 53 54 hardware%l1%size = 32*1024 55 56 hardware%l1%line_size = 64 57 58 hardware%l2%size = 4096*1024 59 60 hardware%l2%line_size = 64 61 62 ! set the block_size so each block fits in the l1 cache 63 ! the block_size should be a multiple of the cache line (minus 2 lines to avoid powers of 2) 64 65 hardware%dblock_size = hardware%l1%size / (4*8) 66 hardware%dblock_size = hardware%dblock_size - mod(hardware%dblock_size, hardware%l1%line_size) - 2*hardware%l1%line_size 67 68 hardware%zblock_size = hardware%l1%size / (4*16) 69 hardware%zblock_size = hardware%zblock_size - mod(hardware%zblock_size, hardware%l1%line_size) - 2*hardware%l1%line_size 70 71 end subroutine hardware_init 72 73 subroutine hardware_end 74 75 end subroutine hardware_end 76 77end module hardware_oct_m 78 79!! Local Variables: 80!! mode: f90 81!! coding: utf-8 82!! End: 83