📄 dolcc
字号:
#!/bin/bash# Check whether a simulation time is given.if [ -z "$1" ] ; then echo "Please specify a simulation time as the second argument, e.g." echo "to simulate 10 minutes type: " $0 "10" exitfi# Compile all four nodes of a 2x2 mMips network# Memory assumptions: # 0x0000 - 0x3FFF : Instructions (ROM, 16k)# 0x4000 - 0x4FFF : Reserved for user data.# Address range in C source code: 0x0 - 0xFFF# 0x5000 - 0x7FFF : Data (globals, locals and stack, 16k)# Address range in C source code: 0x1000 - 0x3FFF# Output start date and time.date# Remove old output files#make clean# Compile all four nodes of the 2x2 network.rm -f mips_rom.x0y0.binrm -f mips_rom.x1y0.binrm -f mips_rom.x0y1.binrm -f mips_rom.x1y1.binlcc -N -AA -o mips_rom.x0y0.bin -I$NOCTOOLS/src -L$NOCTOOLS/mmips -lmtools -lstdcomm -lsprintf gossip_nodo0.clcc -N -AA -o mips_rom.x1y0.bin -I$NOCTOOLS/src -L$NOCTOOLS/mmips -lmtools -lstdcomm -lsprintf gossip_nodo1.clcc -N -AA -o mips_rom.x0y1.bin -I$NOCTOOLS/src -L$NOCTOOLS/mmips -lmtools -lstdcomm -lsprintf gossip_nodo2.c# Create all four RAM's. There are two special addresses:# 0x4000 : 4 bytes, node's personal address (= sc_my_address in stdcomm.h).# 0x4004 : 4 bytes, destination address passed as parameter to sc_send()./dump node_info.bin 0 7 '\0' > mips_ram.x0y0.bin # 8 special bytes../dump node_info.bin 1000 5087 '\0' >> mips_ram.x0y0.bin # 4k-8 zero bytes../dump mips_rom.x0y0.bin 20480 32767 '\0' >> mips_ram.x0y0.bin # Program data (16k)../dump node_info.bin 8 15 '\0' > mips_ram.x1y0.bin # 8 special bytes../dump node_info.bin 1000 5087 '\0' >> mips_ram.x1y0.bin # 4k-8 zero bytes../dump mips_rom.x1y0.bin 20480 32767 '\0' >> mips_ram.x1y0.bin # Program data (16k)../dump node_info.bin 16 23 '\0' > mips_ram.x0y1.bin # 8 special bytes../dump node_info.bin 1000 5087 '\0' >> mips_ram.x0y1.bin # 4k-8 zero bytes../dump mips_rom.x0y1.bin 20480 32767 '\0' >> mips_ram.x0y1.bin # Program data (16k)../dump node_info.bin 24 31 '\0' > rem_mem.x1y1.bin # 8 special bytes../dump node_info.bin 1000 17375 '\0' >> rem_mem.x1y1.bin # 16k-8 zero bytes.# Make the nodes executables.chmod a-x ./mips_rom*# Do the simulation if the simulation time is > 0.if [ $1 = 0 ]; then echo "No simulation was started." else let sim_cycles_one_minute=480000 # Takes about a minute to simulate on CO3. let sim_time=$1 # Number of minutes to simulate. let sim_cycles_total=$sim_time*$sim_cycles_one_minute echo "Estimated simulation time $sim_time minutes.\n" time ./mips $sim_cycles_total # Replace the results in the dumps directory with the new output. rm -f ./dumps/*.dump mv ./mips_ram.x0y0.dump ./dumps mv ./mips_ram.x1y0.dump ./dumps mv ./mips_ram.x0y1.dump ./dumps mv ./rem_mem.x1y1.dump ./dumpsfi# Output end date and time.dateif [ $1 != 0 ]; then # Echo the debugging info (if present). ./strings.shfi
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -