skordal / potato

A simple RISC-V processor for use in FPGA designs.
BSD 3-Clause "New" or "Revised" License
256 stars 41 forks source link

Why Program memory Generated by extact_hex.shdoes not 8 hex digit for all instruction #20

Closed Mohsannaeem closed 5 years ago

Mohsannaeem commented 5 years ago

I had install RISCV GNU toolchain for 32 bit.and run extract_hex. sh to generate Program memory and data memory .but Program memory not looks fine.because I think there should be all instruction should be 8 hex digit .Did i installed wrong or Did i need to change extract_hex.sh .All the file are attached

///extract_hex.sh

!/bin/bash

The Potato Processor - A simple processor for FPGAs

This script extracts the code and data sections from executables and

produces hex files that can be used to initialize the instruction and

data memories in the testbench.

if [ -z "$1" -o -z "$2" -o -z "$3" ]; then echo "exctract_hex " exit 1 fi

if [ -z "$TOOLCHAIN_PREFIX" ]; then TOOLCHAIN_PREFIX=riscv32-unknown-elf fi;

$TOOLCHAIN_PREFIX-objdump -d -w $1 | sed '1,5d' | awk '!/:$/ { print $2; }' | sed '/^$/d' > $2; \ test -z "$($TOOLCHAIN_PREFIX-readelf -l $1 | grep .data)" || \ $TOOLCHAIN_PREFIX-objdump -s -j .data $1 | sed '1,4d' | \ awk '!/:$/ { for (i = 2; i < 6; i++) print $i; }' | sed '/^$/d' > $3;

exit 0

///C code for hello.c int main(){ int a=5; int b=10; int c=15; int d,e; d=a+b; e+d+c; }

//Program Memory: 00002197 bcc18193 c3418513 c5018613 8e09 4581 22e9 00000517 12a50513 28fd 2a99 4502 004c 4601 2075 a8f5 8082 c2818713 c2818793 00e78b63 00000337 00030313 00030563 c2818513 8302 8082 c2818593 c2818793 8d9d 8589 4789 02f5c5b3 c991 00000337 00030313 00030563 c2818513 8302 8082 c341c703 eb0d 1141 c422 c606 843e 376d 000007b7 00078793 cb81 6545 43450513 00000097 000000e7 4785 c2f18a23 40b2 4422 0141 8082 8082 000007b7 00078793 cf91 6545 1141 c3818593 43450513 c606 00000097 000000e7 40b2 0141 bfb5 fd010113 02812623 03010413 00500793 fef42623 00a00793 fef42423 00f00793 fef42223 fec42703 fe842783 00f707b3 fef42023 00000793 00078513 02c12403 03010113 00008067 85aa 4681 4601 4501 a28d 1141 4581 c422 c606 842a 2a5d c281a503 5d5c c391 9782 8522 2c89 1141 67c5 c422 6445 43c78713 44040413 8c19 c226 c606 8409 43c78493 e411 4422 40b2 4492 0141 b5d9 147d 00241793 97a6 439c 9782 b7e5 1141 67c5 c422 6445 43878713 43840413 8c19 c226 c04a c606 8409 4481 43878913 02849663 3d49 67c5 6445 43878713 43c40413 8c19 8409 4481 43878913 00849f63 40b2 4422 4492 4902 0141 8082 00249793 97ca 439c 0485 9782 b7e1 00249793 97ca 439c 0485 9782 bfd9 433d 872a 02c37363 00f77793 efbd e5ad ff067693 8a3d 96ba c30c c34c c70c c74c 0741 fed76be3 e211 8082 40c306b3 068a 00000297 9696 00a68067 00b70723 00b706a3 00b70623 00b705a3 00b70523 00b704a3 00b70423 00b703a3 00b70323 00b702a3 00b70223 00b701a3 00b70123 00b700a3 00b70023 8082 0ff5f593 00859693 8dd5 01059693 8dd5 b761 00279693 00000297 9696 8286 fa8680e7 8096 17c1 8f1d 963e f8c374e3 b7a5 c281a703 832a 14872783 e789 14c70793 14f72423 43d8 487d 557d 04e84263 00271893 02030963 01178533 08c52423 1887a803 4605 00e61633 00c86833 1907a423 10d52423 4689 00d31763 18c7a683 8e55 18c7a623 0705 c3d8 97c6 c78c 4501 8082 7179 ce4e c281a983 cc52 ca56 c85a d606 d422 d226 d04a c65e 8aaa 8a2e 4b05 1489a483 c881 40c0 fff40913 040a 9426 00095d63 50b2 5422 5492 5902 49f2 4a62 4ad2 4b42 4bb2 6145 8082 000a0963 10442783 01478563 197d 1471 bfd9 40d8 405c 177d 03271663 0124a223 d7f5 1884a683 012b1733 0044ab83 8ef9 ee89 9782 40dc fb7790e3 1489a783 fc9787e3 bf51 00042223 bfe1 18c4a683 08442583 8f75 e701 8556 9782 bfe9 852e 9782 bfd1 4581 4601 4681 4701 4781 05d00893 00000073 00055b63 1141 c422 842a c606 40800433 2021 c100 a001 a001 c301a503 8082

DM.txt PM.txt

skordal commented 5 years ago

Hi,

How did you compile your application? Which compiler flags did you use, and what version of the compiler are you using?

Mohsannaeem commented 5 years ago

Oh sorry that's my mistake I had compiled tool chain for extension Compressed . ./configure --prefix=/opt/riscv --with-arch=rv32imac --with-abi=ilp32 What will be flags for potato .Please Guide me

Thanks for your reply