📄 dolcc
字号:
#!/bin/bash
# Compile all four nodes of a 2x2 mMips network and run a simulation.
# Memory assumptions (0x1000=4k):
# 0x0000 - 0x3FFF : Instructions (ROM, 16k)
# 0x4000 - 0x4FFF : Reserved for user data (4k).
# Address range in C source code: 0x0 - 0xFFF
# 0x5000 - 0x7FFF : Data (globals, locals and stack, 12k)
# Address range in C source code: 0x1000 - 0x3FFF
# 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 500 minutes type: " $0 "500"
exit
fi
# Output start date and time.
date
# Compile all four nodes of the 2x2 network.
rm -f mips_rom.x0y0.bin
rm -f mips_rom.x1y0.bin
rm -f mips_rom.x0y1.bin
rm -f mips_rom.x1y1.bin
lcc -N -AA -o mips_rom.x0y0.bin -I$NOCTOOLS/src -L$NOCTOOLS/mmips -lmtools -lstdcomm -lsprintf parse.c tree_vld.c huffman.c step1.c
lcc -N -AA -o mips_rom.x1y0.bin -I$NOCTOOLS/src -L$NOCTOOLS/mmips -lmtools -lstdcomm -lsprintf fast_int_idct.c step2.c
lcc -N -AA -o mips_rom.x0y1.bin -I$NOCTOOLS/src -L$NOCTOOLS/mmips -lmtools -lstdcomm -lsprintf color.c step3.c
# Create all four RAMs.
# The user data portion of memory is used as follows:
# * 0x4000-0x4DFF: Input picture (x0y0) or free space (other nodes)
# * 0x4E00-0x4FFF: Output of mprintf() debug function.
let userdata_end=4096-1
let progdata_start=5*4096 # Data in code binary starts at 0x5000 (0x1000=4k)
let progdata_end=8*4096-1 # Data segment ends at 0x8000-1
let end_image1=4096-1
let start_image2=4096
let end_image2=2*4096-1
let start_data=2*4096
./dump mips_ram.empty.bin 0 $userdata_end '\0' > mips_ram.x0y0.bin
./dump mips_rom.x0y0.bin $progdata_start $progdata_end '\0' >> mips_ram.x0y0.bin
./dump mips_ram.empty.bin 0 $userdata_end '\0' > mips_ram.x1y0.bin
./dump mips_rom.x1y0.bin $progdata_start $progdata_end '\0' >> mips_ram.x1y0.bin
./dump mips_ram.empty.bin 0 $userdata_end '\0' > mips_ram.x0y1.bin
./dump mips_rom.x0y1.bin $progdata_start $progdata_end '\0' >> mips_ram.x0y1.bin
# 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 ./dumps
fi
# Output end date and time.
date
if [ $1 != 0 ]; then
# Echo the debugging info (if present).
./strings.sh
fi
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -