dev: Use the new ByteOrder param type in SimpleUart
authorAndreas Sandberg <andreas.sandberg@arm.com>
Mon, 24 Aug 2020 16:55:45 +0000 (17:55 +0100)
committerAndreas Sandberg <andreas.sandberg@arm.com>
Thu, 10 Sep 2020 14:27:09 +0000 (14:27 +0000)
Use the new ByteOrder param type in SimpleUart. The default value is
currently little endian. However, it is expected that most users of
this device will use single-byte accesses which aren't affected by
endianness.

Change-Id: I3f5d4ea566e5127474cff976332bd53c5b49b9e2
Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/33295
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
src/dev/serial/Uart.py
src/dev/serial/simple.cc

index 97efcdd46209ef02b162ba8eb4700a2c3502927b..7955d69163b928e9358407768e3cf1287c6f0343 100644 (file)
@@ -52,7 +52,7 @@ class Uart(BasicPioDevice):
 class SimpleUart(Uart):
     type = 'SimpleUart'
     cxx_header = "dev/serial/simple.hh"
-    big_endian = Param.Bool(False, "Is the device Big Endian?")
+    byte_order = Param.ByteOrder("little", "Device byte order")
     pio_size = Param.Addr(0x4, "Size of address range")
     end_on_eot = Param.Bool(False, "End the simulation when a EOT is "\
                             "received on the UART")
index 97018abbe32c240735e19aaff73bd33e13e06628..339d6b96dc0c53a2c07d767d6de7813c7a47b55a 100644 (file)
@@ -43,9 +43,7 @@
 #include "sim/sim_exit.hh"
 
 SimpleUart::SimpleUart(const SimpleUartParams *p)
-    : Uart(p, p->pio_size),
-      byteOrder(p->big_endian ? ByteOrder::big : ByteOrder::little),
-      endOnEOT(p->end_on_eot)
+    : Uart(p, p->pio_size), byteOrder(p->byte_order), endOnEOT(p->end_on_eot)
 {
 }