Commit 8d7b8692 authored by Jens Korinth's avatar Jens Korinth
Browse files

platform_global.h shall be new single-point-of-truth

* number of slots shall be fixed in this location
* no other global values have been defined yet, but should be placed
  here once they are
* Scala code parses the header file and uses the value
* Tcl code also parsed the header file and uses the value
parent e2833f2d
...@@ -79,8 +79,8 @@ namespace eval arch { ...@@ -79,8 +79,8 @@ namespace eval arch {
set mc [expr "$mc + ($no * $masterc)"] set mc [expr "$mc + ($no * $masterc)"]
set sc [expr "$sc + ($no * $slavec)"] set sc [expr "$sc + ($no * $slavec)"]
} }
if {$totalInst > 128} { if {$totalInst > [::tapasco::get_platform_num_slots]} {
error "ERROR: Currently only 128 instances of target IP are supported." error "ERROR: Currently only [::tapasco::get_platform_num_slots] instances of target IP are supported."
exit 1 exit 1
} }
set max_masters [expr [join [platform::max_masters] +]] set max_masters [expr [join [platform::max_masters] +]]
...@@ -88,8 +88,8 @@ namespace eval arch { ...@@ -88,8 +88,8 @@ namespace eval arch {
puts "ERROR: Configuration requires connection of $mc M-AXI interfaces, but the Platform supports only $max_masters." puts "ERROR: Configuration requires connection of $mc M-AXI interfaces, but the Platform supports only $max_masters."
exit 1 exit 1
} }
if {$sc > 128} { if {$sc > [::tapasco::get_platform_num_slots]} {
puts "ERROR: Configuration requires connection of $sc S-AXI interfaces; at the moment only 128 are supported." puts "ERROR: Configuration requires connection of $sc S-AXI interfaces; at the moment only [::tapasco::get_platform_num_slots] are supported."
exit 1 exit 1
} }
} }
......
...@@ -478,4 +478,14 @@ namespace eval tapasco { ...@@ -478,4 +478,14 @@ namespace eval tapasco {
puts [format "Adding bit $flag to capability bitfield: 0x%08x (%d) -> 0x%08x (%d)." $flags $flags $nflags $nflags] puts [format "Adding bit $flag to capability bitfield: 0x%08x (%d) -> 0x%08x (%d)." $flags $flags $nflags $nflags]
set capabilities_0 $nflags set capabilities_0 $nflags
} }
proc get_platform_num_slots {} {
set f [open "$::env(TAPASCO_HOME)/platform/common/include/platform_global.h" "r"]
set fl [split [read $f] "\n"]
foreach line $fl {
if {[regexp {.PLATFORM_NUM_SLOTS\s*(\d+)} $line _ ret} {
return $ret
}
}
}
} }
...@@ -26,7 +26,5 @@ ...@@ -26,7 +26,5 @@
#define PLATFORM_API_GLOBAL_H__ #define PLATFORM_API_GLOBAL_H__
#define PLATFORM_NUM_SLOTS 128 #define PLATFORM_NUM_SLOTS 128
#define PLATFORM_ADDRESS_MAP_START 0x800
#define PLATFORM_ADDRESS_MAP_INVALID_BASE 0xFFC0FEFE
#endif /* PLATFORM_API_GLOBAL_H__ */ #endif /* PLATFORM_API_GLOBAL_H__ */
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
} }
proc max_masters {} { proc max_masters {} {
return [list 128] return [list [::tapasco::get_platform_num_slots]]
} }
proc get_address_map {{pe_base ""}} { proc get_address_map {{pe_base ""}} {
...@@ -96,8 +96,8 @@ ...@@ -96,8 +96,8 @@
set msix_int [create_bd_pin -dir "O" "msix_int"] set msix_int [create_bd_pin -dir "O" "msix_int"]
set m_axi [create_bd_intf_pin -mode Master -vlnv [tapasco::ip::get_vlnv "aximm_intf"] "M_MSIX"] set m_axi [create_bd_intf_pin -mode Master -vlnv [tapasco::ip::get_vlnv "aximm_intf"] "M_MSIX"]
set num_irqs 132 set num_irqs_threadpools [::tapasco::get_platform_num_slots]
set num_irqs_threadpools 128 set num_irqs [expr $num_irqs_threadpools + 4]
set irq_concat_ss [tapasco::ip::create_xlconcat "interrupt_concat" 6] set irq_concat_ss [tapasco::ip::create_xlconcat "interrupt_concat" 6]
......
...@@ -49,5 +49,5 @@ case class Platform ( ...@@ -49,5 +49,5 @@ case class Platform (
} }
object Platform extends Builds[Platform] { object Platform extends Builds[Platform] {
private final val DEFAULT_SLOTCOUNT: Int = 128 private final val DEFAULT_SLOTCOUNT: Int = de.tu_darmstadt.cs.esa.tapasco.PLATFORM_NUM_SLOTS
} }
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
// along with Tapasco. If not, see <http://www.gnu.org/licenses/>. // along with Tapasco. If not, see <http://www.gnu.org/licenses/>.
// //
package de.tu_darmstadt.cs.esa.tapasco.base package de.tu_darmstadt.cs.esa.tapasco.base
import de.tu_darmstadt.cs.esa.tapasco.{PLATFORM_NUM_SLOTS => MAX_SLOTS}
import de.tu_darmstadt.cs.esa.tapasco.json._ import de.tu_darmstadt.cs.esa.tapasco.json._
import de.tu_darmstadt.cs.esa.tapasco.jobs._ import de.tu_darmstadt.cs.esa.tapasco.jobs._
import de.tu_darmstadt.cs.esa.tapasco.jobs.json._ import de.tu_darmstadt.cs.esa.tapasco.jobs.json._
...@@ -32,7 +33,6 @@ import java.time.format.DateTimeFormatter, java.time.LocalDateTime ...@@ -32,7 +33,6 @@ import java.time.format.DateTimeFormatter, java.time.LocalDateTime
* deserialize basic TPC entities to and from Json format. * deserialize basic TPC entities to and from Json format.
**/ **/
package object json { package object json {
private final val MAX_SLOTS = 128
private def totalCountOk(c: Seq[Composition.Entry]): Boolean = private def totalCountOk(c: Seq[Composition.Entry]): Boolean =
(c map (_.count) fold 0) (_ + _) <= MAX_SLOTS (c map (_.count) fold 0) (_ + _) <= MAX_SLOTS
......
...@@ -32,4 +32,21 @@ package de.tu_darmstadt.cs.esa ...@@ -32,4 +32,21 @@ package de.tu_darmstadt.cs.esa
* currently loaded composition, and to setup, launch and collect * currently loaded composition, and to setup, launch and collect
* jobs to be executed on the threadpool. * jobs to be executed on the threadpool.
**/ **/
package object tapasco package object tapasco {
import java.nio.file._
import scala.io._
private lazy val REGEX_PLATFORM_NUM_SLOTS = """define\s+PLATFORM_NUM_SLOTS\s+(\d+)""".r
lazy val PLATFORM_NUM_SLOTS: Int = {
val f = Paths.get(sys.env("TAPASCO_HOME"))
.resolve("platform")
.resolve("common")
.resolve("include")
.resolve("platform_global.h")
assert (f.toFile.exists, s"$f does not exist")
REGEX_PLATFORM_NUM_SLOTS.findFirstMatchIn(Source.fromFile(f.toString) mkString "")
.map(_.group(1).toInt)
.getOrElse(throw new Exception("could not parse PLATFORM_NUM_SLOTS"))
}
}
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
// along with Tapasco. If not, see <http://www.gnu.org/licenses/>. // along with Tapasco. If not, see <http://www.gnu.org/licenses/>.
// //
package de.tu_darmstadt.cs.esa.tapasco.parser package de.tu_darmstadt.cs.esa.tapasco.parser
import de.tu_darmstadt.cs.esa.tapasco.PLATFORM_NUM_SLOTS
import FormatObject._ import FormatObject._
import scala.util.Properties.{lineSeparator => NL} import scala.util.Properties.{lineSeparator => NL}
...@@ -92,7 +93,7 @@ configuration via `tapasco -n config.json`. ...@@ -92,7 +93,7 @@ configuration via `tapasco -n config.json`.
"" & "" &
Arg("COMPOSITION", """'[' <KERNEL> x <COUNT> [, <KERNEL> x <COUNT>]* ']'""") & Arg("COMPOSITION", """'[' <KERNEL> x <COUNT> [, <KERNEL> x <COUNT>]* ']'""") &
Indent(Arg("KERNEL", "name of kernel/core, a quoted/unquoted string") & Indent(Arg("KERNEL", "name of kernel/core, a quoted/unquoted string") &
Arg("COUNT", "number of instances (0 < x <= 128)")) & Arg("COUNT", s"number of instances (0 < x <= ${PLATFORM_NUM_SLOTS})")) &
"" & "" &
Arg("Examples:", "[ precision_counter x 128 ]" & "[arrayupdate x 4, arraysum x 8]")) Arg("Examples:", "[ precision_counter x 128 ]" & "[arrayupdate x 4, arraysum x 8]"))
...@@ -168,7 +169,7 @@ configuration via `tapasco -n config.json`. ...@@ -168,7 +169,7 @@ configuration via `tapasco -n config.json`.
Arg(" p", "generate only placer errors") & Arg(" p", "generate only placer errors") &
Arg(" o", "generate only other errors"))) & Arg(" o", "generate only other errors"))) &
"" & "" &
"NOTE: Currently the total number of PEs must be <= 128.") "NOTE: Currently the total number of PEs must be <= ${PLATFORM_NUM_SLOTS}.")
private def corestats() = Section("Core Statistics Job", private def corestats() = Section("Core Statistics Job",
Block("Evaluation helper job that automatically gathres the out-of-context results" ~ Block("Evaluation helper job that automatically gathres the out-of-context results" ~
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment