Platform.scala 2.5 KB
Newer Older
1
2
3
//
// Copyright (C) 2014 Jens Korinth, TU Darmstadt
//
4
// This file is part of Tapasco (TPC).
5
//
6
// Tapasco is free software: you can redistribute it and/or modify
7
8
9
10
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
11
// Tapasco is distributed in the hope that it will be useful,
12
13
14
15
16
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
17
// along with Tapasco.  If not, see <http://www.gnu.org/licenses/>.
18
19
20
21
22
23
//
/**
 * @file    Platform.scala
 * @brief   Model: TPC Platform.
 * @authors J. Korinth, TU Darmstadt (jk@esa.cs.tu-darmstadt.de)
 **/
24
25
package de.tu_darmstadt.cs.esa.tapasco.base
import  de.tu_darmstadt.cs.esa.tapasco.json._
26
27
28
29
30
31
32
33
34
import  builder._
import  json._
import  java.nio.file._

case class Platform (
      descPath: Path,
      name: String,
      private val _tclLibrary: Path,
      part: String,
35
36
      boardPart: Option[String],
      boardPreset: Option[String],
37
38
      targetUtilization: Int,
      supportedFrequencies: Seq[Int],
39
      private val _slotCount: Option[Int],
40
41
42
43
44
45
46
47
48
49
50
      description: Option[String],
      private val _harness: Option[Path],
      private val _api: Option[Path],
      private val _testbenchTemplate: Option[Path],
      private val _benchmark: Option[Path]
    ) extends Description(descPath) {
  val tclLibrary: Path                = resolve(_tclLibrary)
  val harness: Option[Path]           = _harness map (resolve _)
  val api: Option[Path]               = _api map (resolve _)
  val testbenchTemplate: Option[Path] = _testbenchTemplate map (resolve _)
  val benchmark: Option[Benchmark]    = _benchmark flatMap (p => Benchmark.from(resolve(p)).toOption)
51
  val slotCount: Int                  = _slotCount getOrElse Platform.DEFAULT_SLOTCOUNT
52
53
54
55
56
57
  require (mustExist(tclLibrary), "Tcl library %s does not exist".format(tclLibrary.toString))
  harness foreach           { p => require(mustExist(p), "harness file %s does not exist".format(p.toString)) }
  api foreach               { p => require(mustExist(p), "api file %s does not exist".format(p.toString)) }
  testbenchTemplate foreach { p => require(mustExist(p), "testbench template %s does not exist".format(p.toString)) }
}

58
59
60
object Platform extends Builds[Platform] {
  private final val DEFAULT_SLOTCOUNT: Int = 128
}