The Amber processor core is an ARM-compatible 32-bit RISC processor. The Amber core is fully compatible with the ARM® v2a instruction set architecture (ISA) and is therefore supported by the GNU toolset.
I would like to try run on my Mac Mini, so, I install Armber, tools and do some modification…
1. Download the Amber project from the Opencores Subversion server
$ mkdir ~/AmberInstallPath $ cd ~/AmberInstallPath $ svn --username YOUR_NAME -password PASSWORD co http://opencores.org/ocsvn/amber/amber/trunk
2. Install the GNU cross compiler
$ sudo port install arm-none-linux-gnueabi-gcc $ sudo port install gawk $ cd /opt/local/bin $ sudo ln -s gawk awk $ sudo ln -s arm-none-linux-gnueabi-gcc-2005q3 arm-none-linux-gnueabi-gcc
3. Install Icarus Verilog Simulator
$ sudo port install iverilog
4. Edit ~/.profile and add the following
$ export AMBER_BASE=~/AmberInstallPath/trunk $ export AMBER_CROSSTOOL=arm-none-linux-gnueabi
5. Make scripts executable and create a run link
$ cd $AMBER_BASE $ chmod +x hw/tools/*.sh sw/tools/*.sh $ ln -s ../tools/run.sh hw/sim/run
6. Create $AMBER_BASE/hw/tools/runIV.patch by following
--- run.sh 2011-04-29 08:47:23.000000000 +0800 +++ runIV.sh 2011-04-29 09:14:21.000000000 +0800 @@ -46,12 +46,9 @@ AMBER_LOAD_MAIN_MEM=" " AMBER_TIMEOUT=0 AMBER_LOG_FILE="tests.log" -SET_G=0 SET_M=0 SET_D=0 SET_T=0 -SET_S=0 -SET_V=0 SET_A=0 SET_5=0 @@ -59,14 +56,11 @@ SET_5=0 # show program usage show_usage() { echo "Usage:" - echo "run [-a] [-g] [-d] [-t] [-s] [-v]" + echo "run [-a] [-d] [-t]" echo " -h : Help" echo " -a : Run hardware tests (all tests in $AMBER_BASE/hw/tests)" - echo " -g : Use Modelsim GUI" echo " -d : Create vcd file" echo " -t : Create vcd file and terminate" - echo " -s : Use Xilinx Spatran6 Libraries (slower sim)" - echo " -v : Use Xilinx Virtex6 Libraries (slower sim)" echo " -5 : Use Amber25 core instead of Amber23 core" echo "" exit @@ -103,14 +97,8 @@ do case $1 in -a) SET_A=1 # all tests shift ;; - -s) SET_S=1 # Xilinx libs - shift ;; - -v) SET_V=1 # Xilinx libs - shift ;; -5) SET_5=1 # Xilinx libs shift ;; - -g) SET_G=1 # Bring up GUI - shift ;; -d) SET_D=1 DUMP_START=$2 shift 2;; @@ -135,24 +123,7 @@ done # Set comfiguration based on command-line options #-------------------------------------------------------- -if [ $SET_G == 1 ]; then - RUN_OPTIONS="-do cmd.do" -else - RUN_OPTIONS="${RUN_OPTIONS} -c -do run.do" -fi - -if [ $SET_S == 1 ]; then - FPGA="+define+XILINX_SPARTAN6_FPGA +define+XILINX_FPGA" - RUN_OPTIONS="${RUN_OPTIONS} -t ps +notimingchecks -L unisims_ver -L secureip" -else - if [ $SET_V == 1 ]; then - FPGA="+define+XILINX_VIRTEX6_FPGA +define+XILINX_FPGA" - RUN_OPTIONS="${RUN_OPTIONS} -t ps +notimingchecks" - else - FPGA=" " - fi -fi - +RUN_OPTIONS="-f iverilog.f" if [ $SET_D == 1 ]; then AMBER_DUMP_VCD="+define+AMBER_DUMP_VCD +define+AMBER_DUMP_START=$DUMP_START" @@ -173,13 +144,8 @@ else fi if [ $SET_A == 1 ]; then - if [ $SET_S == 1 ]; then - TECH="-s" - elif [ $SET_V == 1 ]; then - TECH="-v" - else - TECH=" " - fi + + TECH=" " if [ $SET_5 == 1 ]; then CORE="-5" @@ -273,54 +239,42 @@ fi #-------------------------------------------------------- -# Modelsim +# iVerilog #-------------------------------------------------------- -if [ $MAKE_STATUS == 0 ]; then - if [ ! -d work ]; then - vlib work - fi - - if [ $? == 0 ]; then - vlog +libext+.v - +incdir+../vlog/amber23+../vlog/amber25+../vlog/system+../vlog/tb+../vlog/ethmac - +incdir+../vlog/lib+../vlog/xs6_ddr3+../vlog/xv6_ddr3 - -y ../vlog/amber23 -y ../vlog/amber25 -y ../vlog/system -y ../vlog/tb -y ../vlog/ethmac - -y ../vlog/lib -y ../vlog/xs6_ddr3 -y ../vlog/xv6_ddr3 - -y $XILINX/verilog/src/unisims - -y $XILINX/verilog/src - ../vlog/tb/tb.v - $XILINX/verilog/src/glbl.v - +define+BOOT_MEM_FILE="$BOOT_MEM_FILE" - +define+BOOT_MEM_PARAMS_FILE="$BOOT_MEM_PARAMS_FILE" - +define+MAIN_MEM_FILE="$MAIN_MEM_FILE" - +define+AMBER_LOG_FILE="$AMBER_LOG_FILE" - +define+AMBER_TEST_NAME="$AMBER_TEST_NAME" - +define+AMBER_SIM_CTRL=$TEST_TYPE - +define+AMBER_TIMEOUT=$AMBER_TIMEOUT - ${FPGA} - $AMBER_CORE - $AMBER_DUMP_VCD - $AMBER_TERMINATE - $AMBER_LOAD_MAIN_MEM - - if [ $? == 0 ]; then - vsim -voptargs="+acc=rnpc" tb ${RUN_OPTIONS} - - # Set a timeout value for the test if it passed - if [ $TEST_TYPE == 1 ]; then - tail -1 /dev/null - if [ $? == 0 ]; then - TICKS=`tail -1 > $AMBER_LOG_FILE -fi + echo "+libext+.v" > iverilog.f + echo "+incdir+../vlog/amber23" >> iverilog.f + echo "+incdir+../vlog/amber25" >> iverilog.f + echo "+incdir+../vlog/system" >> iverilog.f + echo "+incdir+../vlog/tb" >> iverilog.f + echo "+incdir+../vlog/ethmac" >> iverilog.f + echo "+incdir+../vlog/lib" >> iverilog.f + echo "+incdir+../vlog/xs6_ddr3" >> iverilog.f + echo "+incdir+../vlog/xv6_ddr3" >> iverilog.f + echo "-y../vlog/amber23" >> iverilog.f + echo "-y../vlog/amber25" >> iverilog.f + echo "-y../vlog/system" >> iverilog.f + echo "-y../vlog/tb" >> iverilog.f + echo "-y../vlog/ethmac" >> iverilog.f + echo "-y../vlog/lib" >> iverilog.f + echo "-y../vlog/xs6_ddr3" >> iverilog.f + echo "-y../vlog/xv6_ddr" >> iverilog.f + echo "+define+BOOT_MEM_FILE="$BOOT_MEM_FILE"" >> iverilog.f + echo "+define+BOOT_MEM_PARAMS_FILE="$BOOT_MEM_PARAMS_FILE"" >> iverilog.f + echo "+define+MAIN_MEM_FILE="$MAIN_MEM_FILE"" >> iverilog.f + echo "+define+AMBER_LOG_FILE="$AMBER_LOG_FILE"" >> iverilog.f + echo "+define+AMBER_TEST_NAME="$AMBER_TEST_NAME"" >> iverilog.f + echo "+define+AMBER_SIM_CTRL=$TEST_TYPE" >> iverilog.f + echo "+define+AMBER_TIMEOUT=$AMBER_TIMEOUT" >> iverilog.f + echo "$AMBER_CORE" >> iverilog.f + echo "$AMBER_DUMP_VCD" >> iverilog.f + echo "$AMBER_TERMINATE" >> iverilog.f + echo "$AMBER_LOAD_MAIN_MEM" >> iverilog.f + echo "../vlog/tb/tb.v" >> iverilog.f + + rm -rf ./armber + iverilog -f iverilog.f -o armber + ./armber
7. Create runIV script for iverilog simulator
$ cd $AMBER_BASE/hw/tools $ patch -o runIV.sh -i runIV.patch $ chmod +x runIV.sh $ cd $AMBER_BASE/hw/sim $ ln -s ../tools/runIV.sh runIV
8. If you see the iverilog compile error message for log2 function in next step, you could replace log2 by $clog2 to solve the problem.
9. Run a Hello-World Test with Amber 25
$ cd $AMBER_BASE/hw/sim $ runIV -5 hello-world
10. Hello-World simulation Result
Amber Boot Loader v20110202130047 Hello, World! ---------------------------------------------------------------------------- Amber Core > User FIRQ IRQ SVC r0 0x00000010 r1 0x16000000 r2 0x00000000 r3 0x00000000 r4 0x0c80e403 r5 0x00000000 r6 0x00000000 r7 0x00000000 r8 0xdeadbeef 0xdeadbeef r9 0xdeadbeef 0xdeadbeef r10 0x00000011 0xdeadbeef r11 0xf0000000 0xdeadbeef r12 0x00000000 0xdeadbeef r13 0x08000000 0xdeadbeef 0xdeadbeef 0x01ffffb8 r14 (lr) 0x0080e420 0xdeadbeef 0xdeadbeef 0x20000787 r15 (pc) 0x0080e960 Status Bits: N=0, Z=1, C=1, V=0, IRQ Mask 0, FIRQ Mask 0, Mode = User ---------------------------------------------------------------------------- ++++++++++++++++++++ Passed hello-world 29320 ticks ++++++++++++++++++++
Thank you for this patch 🙂