rishabh_jain091

two_level_copy.py

Mar 1st, 2019
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.58 KB | None | 0 0
  1. from __future__ import print_function
  2.  
  3. import m5
  4. import sys
  5. from m5.objects import *
  6.  
  7. m5.util.addToPath('../../')
  8.  
  9. from caches import *
  10.  
  11. from common import SimpleOpts
  12.  
  13. # Set the usage message to display                                              
  14. SimpleOpts.set_usage("usage: %prog [options] <binary to execute>")              
  15.                                                                                
  16. # Finalize the arguments and grab the opts so we can pass it on to our objects  
  17. (opts, args) = SimpleOpts.parse_args()                                          
  18.                                                                                
  19. # get ISA for the default binary to run. This is mostly for simple testing      
  20. isa = str(m5.defines.buildEnv['TARGET_ISA']).lower()                            
  21.                                                                                
  22. # Default to running 'hello', use the compiled ISA to find the binary          
  23. binary = 'tests/test-progs/hello/bin/' + isa + '/linux/a.out'                  
  24.                                                                                
  25. # Check if there was a binary passed in via the command line and error if      
  26. # there are too many arguments                                                  
  27. if len(args) == 1:                                                              
  28.     binary = args[0]                                                            
  29. elif len(args) > 1:                                                            
  30.     SimpleOpts.print_help()                                                    
  31.     m5.fatal("Expected a binary to execute as positional argument")    
  32.  
  33. print("Version of python is :::::::::::: " + sys.version)
  34.  
  35. #system config
  36. system = System(cpu = [TimingSimpleCPU(cpu_id=i) for i in xrange(2)])
  37. for i in range(2):
  38.     print([TimingSimpleCPU(cpu_id=i)])
  39.  
  40. for i in xrange(2):
  41.     print(system.cpu[i])
  42.  
  43.  
  44. system.clk_domain = SrcClockDomain()
  45. system.clk_domain.clock = '1GHz'
  46. system.clk_domain.voltage_domain = VoltageDomain()
  47.  
  48. system.mem_mode = 'timing'
  49. system.mem_ranges = [AddrRange('512MB')]
  50.  
  51. system.cpu_voltage_domain = VoltageDomain()
  52. system.cpu_clk_domain = SrcClockDomain(clock = '1GHz',voltage_domain= system.cpu_voltage_domain)
  53.  
  54. system.membus = SystemXBar()
  55. system.l2bus = L2XBar()
  56. #multiprocess =[Process(cmd = 'tests/test-progs/hello/bin/riscv/linux/a.out', pid = 100 + i) for i in xrange(2)]
  57. multiprocess =[Process(cmd = 'tests/test-progs/hello/src/a.out', pid = 100 + i) for i in xrange(2)]
  58.  
  59. #cpu config
  60. for i in xrange(2):    
  61.     system.cpu[i].icache = L1ICache(opts)
  62.     system.cpu[i].dcache = L1DCache(opts)
  63.     system.cpu[i].icache.connectCPU(system.cpu[i])
  64.     system.cpu[i].dcache.connectCPU(system.cpu[i])
  65.     system.cpu[i].icache.connectBus(system.l2bus)
  66.     system.cpu[i].dcache.connectBus(system.l2bus)
  67.     system.cpu[i].createInterruptController()
  68.     system.cpu[i].workload = multiprocess[i]
  69.     system.cpu[i].createThreads()
  70.  
  71. system.l2cache = L2Cache()
  72. system.l2cache.cpu_side = system.l2bus.master
  73. system.l2cache.mem_side = system.membus.slave
  74. system.system_port = system.membus.slave
  75.  
  76. system.mem_ctrl = DDR3_1600_8x8()
  77. system.mem_ctrl.range = system.mem_ranges[0]
  78. system.mem_ctrl.port = system.membus.master
  79.  
  80. root = Root(full_system = False, system = system)
  81.  
  82. # instantiate all the objects that we have created above
  83.  
  84. m5.instantiate()
  85.  
  86. print("The simulation is going to start in 3 2 1 .. GOOOO! ")
  87. exit_event = m5.simulate()
  88. print('Exiting @ tick %i because %s' % (m5.curTick(), exit_event.getCause()))
Add Comment
Please, Sign In to add comment