configs,tests: use Sequencer port connect methods
authorTiago Mück <tiago.muck@arm.com>
Sat, 20 Jun 2020 02:08:33 +0000 (21:08 -0500)
committerTiago Mück <tiago.muck@arm.com>
Mon, 7 Dec 2020 19:52:22 +0000 (19:52 +0000)
This patch updates Ruby configuration scripts to use the functions
defined in the RubySequencer python object to connect to cpu ports.

Only the protocol-agnostic scripts were updated. Scripts that assume
a specific protocol (e.g. configs/example/apu_se.py, gpu tests, etc)
and scripts in which the obj connected to the RubySequencer is not a
BaseCPU (e.g. the tests scripts) were not changed as they require a
non-standard port wireup.

Change-Id: I1e931ff0fc93f393cb36fbb8769ea4b48e1a1e86
Signed-off-by: Tiago Mück <tiago.muck@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/31418
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
configs/example/fs.py
configs/example/se.py
configs/learning_gem5/part3/msi_caches.py
configs/learning_gem5/part3/ruby_caches_MI_example.py
configs/ruby/Ruby.py
tests/configs/pc-simple-timing-ruby.py

index 229c50e2b3ab3ae9f2cbc0a45df5dd46aa0f67eb..1cd53db14c483d8a81f94793be999a7c8626a35e 100644 (file)
@@ -172,17 +172,7 @@ def build_test_system(np):
             cpu.createThreads()
             cpu.createInterruptController()
 
-            cpu.icache_port = test_sys.ruby._cpu_ports[i].slave
-            cpu.dcache_port = test_sys.ruby._cpu_ports[i].slave
-
-            cpu.mmu.connectWalkerPorts(
-                test_sys.ruby._cpu_ports[i].slave,
-                test_sys.ruby._cpu_ports[i].slave)
-
-            if buildEnv['TARGET_ISA'] in "x86":
-                cpu.interrupts[0].pio = test_sys.ruby._cpu_ports[i].master
-                cpu.interrupts[0].int_master = test_sys.ruby._cpu_ports[i].slave
-                cpu.interrupts[0].int_slave = test_sys.ruby._cpu_ports[i].master
+            test_sys.ruby._cpu_ports[i].connectCpuPorts(cpu)
 
     else:
         if options.caches or options.l2cache:
index f29008e5d3bb6d02adb20c4340911e515d8d702d..9119c408a877ccca7d3c9c13266e06109d9a319f 100644 (file)
@@ -260,14 +260,7 @@ if options.ruby:
         system.cpu[i].createInterruptController()
 
         # Connect the cpu's cache ports to Ruby
-        system.cpu[i].icache_port = ruby_port.slave
-        system.cpu[i].dcache_port = ruby_port.slave
-        if buildEnv['TARGET_ISA'] == 'x86':
-            system.cpu[i].interrupts[0].pio = ruby_port.master
-            system.cpu[i].interrupts[0].int_master = ruby_port.slave
-            system.cpu[i].interrupts[0].int_slave = ruby_port.master
-            system.cpu[i].mmu.connectWalkerPorts(
-                ruby_port.slave, ruby_port.slave)
+        ruby_port.connectCpuPorts(system.cpu[i])
 else:
     MemClass = Simulation.setMemClass(options)
     system.membus = SystemXBar()
index 86adfd5cb4622297cbec41e7c91bc92a19d4487a..822d98a60c7fe39dcf441349486bad879bb7c6ee 100644 (file)
@@ -105,15 +105,7 @@ class MyCacheSystem(RubySystem):
 
         # Connect the cpu's cache, interrupt, and TLB ports to Ruby
         for i,cpu in enumerate(cpus):
-            cpu.icache_port = self.sequencers[i].slave
-            cpu.dcache_port = self.sequencers[i].slave
-            cpu.mmu.connectWalkerPorts(
-                self.sequencers[i].slave, self.sequencers[i].slave)
-            isa = buildEnv['TARGET_ISA']
-            if isa == 'x86':
-                cpu.interrupts[0].pio = self.sequencers[i].master
-                cpu.interrupts[0].int_master = self.sequencers[i].slave
-                cpu.interrupts[0].int_slave = self.sequencers[i].master
+            self.sequencers[i].connectCpuPorts(cpu)
 
 
 class L1Cache(L1Cache_Controller):
index ac003ff120a93485ad268aff3a353f0d49185b57..e7d20dd6368ce08185bb4f790c3553cc8d1c47c4 100644 (file)
@@ -103,15 +103,7 @@ class MyCacheSystem(RubySystem):
 
         # Connect the cpu's cache, interrupt, and TLB ports to Ruby
         for i,cpu in enumerate(cpus):
-            cpu.icache_port = self.sequencers[i].slave
-            cpu.dcache_port = self.sequencers[i].slave
-            cpu.mmu.connectWalkerPorts(
-                self.sequencers[i].slave, self.sequencers[i].slave)
-            isa = buildEnv['TARGET_ISA']
-            if isa == 'x86':
-                cpu.interrupts[0].pio = self.sequencers[i].master
-                cpu.interrupts[0].int_master = self.sequencers[i].slave
-                cpu.interrupts[0].int_slave = self.sequencers[i].master
+            self.sequencers[i].connectCpuPorts(cpu)
 
 class L1Cache(L1Cache_Controller):
 
index 86d5748e85c64dae07b2d67c8bb6fad0e973cf95..8aa99be308739b43b19abd0911e2c2b37dbc65db 100644 (file)
@@ -226,11 +226,7 @@ def create_system(options, full_system, system, piobus = None, dma_ports = [],
     # Connect the cpu sequencers and the piobus
     if piobus != None:
         for cpu_seq in cpu_sequencers:
-            cpu_seq.pio_master_port = piobus.slave
-            cpu_seq.mem_master_port = piobus.slave
-
-            if buildEnv['TARGET_ISA'] == "x86":
-                cpu_seq.pio_slave_port = piobus.master
+            cpu_seq.connectIOPorts(piobus)
 
     ruby.number_of_virtual_networks = ruby.network.number_of_virtual_networks
     ruby._cpu_ports = cpu_sequencers
index c78033b74b5f0cbde049084d95e864acbff32c79..884fd7da285ab5704740379b92c359cdb5de3935 100644 (file)
@@ -78,14 +78,7 @@ for (i, cpu) in enumerate(system.cpu):
     # create the interrupt controller
     cpu.createInterruptController()
     # Tie the cpu ports to the correct ruby system ports
-    cpu.icache_port = system.ruby._cpu_ports[i].slave
-    cpu.dcache_port = system.ruby._cpu_ports[i].slave
-    cpu.mmu.connectWalkerPorts(
-        system.ruby._cpu_ports[i].slave, system.ruby._cpu_ports[i].slave)
-
-    cpu.interrupts[0].pio = system.ruby._cpu_ports[i].master
-    cpu.interrupts[0].int_master = system.ruby._cpu_ports[i].slave
-    cpu.interrupts[0].int_slave = system.ruby._cpu_ports[i].master
+    system.ruby._cpu_ports[i].connectCpuPorts(cpu)
 
 root = Root(full_system = True, system = system)
 m5.ticks.setGlobalFrequency('1THz')