Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory SM: MemProxy, MemAlign, MemAlignRom, Mem, RomData, InputData. #153

Merged
merged 112 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
112 commits
Select commit Hold shift + click to select a range
16ac673
first commit on memory_checkpoint3
xavi-pinsach Nov 5, 2024
36573d9
fix Arc<ZiskRom>
xavi-pinsach Nov 5, 2024
9d4be19
wip
xavi-pinsach Nov 5, 2024
c53b500
First commit
hecmas Nov 5, 2024
0a3d482
Backup first code draft
fractasy Nov 5, 2024
57d3146
Merge remote-tracking branch 'origin/memory-checkpoint3' into feature…
fractasy Nov 5, 2024
0f4441f
First version of mem_align executor done
hecmas Nov 5, 2024
3ccfde2
wip
xavi-pinsach Nov 6, 2024
f5dfbb7
Create input_data_sm.rs
fractasy Nov 6, 2024
6e495df
Merge from memory_checkpoint3
fractasy Nov 6, 2024
c7a6cf9
Working in the new version
hecmas Nov 6, 2024
71ca095
wip
xavi-pinsach Nov 6, 2024
668c37d
wip
xavi-pinsach Nov 6, 2024
59b5376
minor changes
hecmas Nov 6, 2024
2dde9e7
Merge from memory-checkpoint3
fractasy Nov 6, 2024
855b382
Merge branch 'mem-integration' into feature/memory-align
hecmas Nov 6, 2024
b386952
Working
hecmas Nov 6, 2024
899d017
Fixes
fractasy Nov 6, 2024
3163252
Fix cargo fmt
fractasy Nov 6, 2024
89be820
Fix some clippy errors
fractasy Nov 6, 2024
6094b79
wip
xavi-pinsach Nov 7, 2024
5551def
Fixing bugs
hecmas Nov 7, 2024
1f7786e
mem_proxy to little endian
xavi-pinsach Nov 7, 2024
89a59ad
Fix mem bugs
hecmas Nov 7, 2024
601e524
Merge remote-tracking branch 'origin/develop' into mem-integration
xavi-pinsach Nov 7, 2024
968a539
Fix mem bugs
hecmas Nov 7, 2024
96131a8
remove println
xavi-pinsach Nov 7, 2024
7ad568f
Minor fixes
hecmas Nov 7, 2024
3cdb3ac
Merge branch 'mem-integration' into feature/memory-align
hecmas Nov 7, 2024
c7d6611
fix mem.pil
xavi-pinsach Nov 7, 2024
90f8bae
update to roofman 0.0.10
xavi-pinsach Nov 7, 2024
2672ca8
add comment
xavi-pinsach Nov 7, 2024
264a2fd
More fixes
fractasy Nov 7, 2024
5380f5b
wip
hecmas Nov 7, 2024
f77db6b
wip
hecmas Nov 8, 2024
0036a50
Mem align compiling
hecmas Nov 8, 2024
d67b280
fixes
hecmas Nov 8, 2024
451cdfb
WIP mem proxy, rebase
zkronos73 Nov 8, 2024
ad7381e
rebase
zkronos73 Nov 8, 2024
257fe75
Range check done
hecmas Nov 8, 2024
125b205
minor bugs,logs on memory proxy
zkronos73 Nov 9, 2024
54c2fb7
Merge branch 'feature/memory-align' into feature/mem-align-proxy
hecmas Nov 9, 2024
bb1207c
Merge pull request #160 from 0xPolygonHermez/feature/mem-align-proxy
hecmas Nov 9, 2024
00fd718
filter some address to test
zkronos73 Nov 9, 2024
f6fbc3d
wip
hecmas Nov 9, 2024
2494dbb
Merge. Write RO ELF sections to memory via Zisk instructions.
fractasy Nov 9, 2024
51416cf
Merge branch 'feature/memory-align' into feature/mem-align-proxy
zkronos73 Nov 9, 2024
0c0d19a
Cleaning up
hecmas Nov 10, 2024
66d20db
Fix errors
hecmas Nov 10, 2024
2b511ec
mem align working
hecmas Nov 11, 2024
3665d7a
Write RO data sections using code instructions
fractasy Nov 20, 2024
b150581
Fix cargo fmt
fractasy Nov 20, 2024
da6ad95
Fix cargo clippy
fractasy Nov 20, 2024
d2a09ad
Fix riscof test by not writing RO sections with addr=0 and fixing vec…
fractasy Nov 20, 2024
c5a8683
CArgo fmt
hecmas Nov 20, 2024
99f4b8c
WIP memory proxy
zkronos73 Nov 21, 2024
ab916e0
merge changes of mem_align
zkronos73 Nov 21, 2024
e46ebf2
merge develop on branch
zkronos73 Nov 21, 2024
0cee2d4
Ignore ELF sections with addr=0
fractasy Nov 21, 2024
9d8e75c
WIP memory state machhines
zkronos73 Nov 21, 2024
5819463
WIP memory proxy
zkronos73 Nov 21, 2024
632d7cd
Mem rom fully working
hecmas Nov 22, 2024
e92abdd
Mem align fully working
hecmas Nov 22, 2024
4593a0d
WIP mem proxy
zkronos73 Nov 22, 2024
5aeb580
merge changes of feature/memory-align to feature/memory-align-with-proxy
zkronos73 Nov 22, 2024
abcb73c
Cleaning the mem align
hecmas Nov 22, 2024
cec3d41
Removing hashmaps and cleaning up stuff a little bit
hecmas Nov 22, 2024
5b37bc2
WIP mem - mem_align integration
zkronos73 Nov 22, 2024
8f61207
WIP merge changes from feature/memory-align to feature/memory-align-w…
zkronos73 Nov 22, 2024
e0ebd21
fix bugs with memory
zkronos73 Nov 24, 2024
84be677
Fixing typos
hecmas Nov 25, 2024
4960e93
Merge pull request #174 from 0xPolygonHermez/fix/mem-align
hecmas Nov 25, 2024
42287a2
Merge branch 'develop' into feature/memory-align-with-proxy
zkronos73 Nov 25, 2024
02f3edc
Merge from feature/memory-align-with-proxy
fractasy Nov 25, 2024
813ae35
Fix compilation after merge
fractasy Nov 25, 2024
282c0d5
Uncomment line in mem.pil
fractasy Nov 25, 2024
77c3015
WIP integration input_data and rom_data
zkronos73 Nov 25, 2024
9df0cf9
fix invalid assert on mem_align
zkronos73 Nov 25, 2024
4f76b7c
Remove store_c_slice to fix parallel execution without memory
fractasy Nov 25, 2024
5ef0915
Mem align and mem fixes (#175)
hecmas Nov 25, 2024
5cba3e6
merge feature/memory-align-with-proxy on feature/input_sm
zkronos73 Nov 25, 2024
2d88c5c
WIP memories integration
zkronos73 Nov 27, 2024
60af609
Removing unnecessary code
hecmas Nov 28, 2024
0f7c90b
WIP memory integration
zkronos73 Dec 2, 2024
2951982
update mem executors with correct call to register_predecessor
zkronos73 Dec 3, 2024
622eaec
Memory required extended data to build Memory SM proof
fractasy Dec 3, 2024
56a4294
Fix cargo clippy
fractasy Dec 3, 2024
c598844
Feature/custom commits (#166)
RogerTaule Dec 3, 2024
281a4c9
Merge branch 'pil-cleanup' into update_proofman
RogerTaule Dec 3, 2024
9392443
remove old input_data.pil
zkronos73 Dec 3, 2024
7133586
merge remote-tracking branch 'origin/feature/memory_required_extended…
zkronos73 Dec 3, 2024
12ea025
WIP memory required changes integration
zkronos73 Dec 3, 2024
9d89546
Zisk working with last proofman version
RogerTaule Dec 4, 2024
f88f3e3
Updating book and Cargo.toml to point to 0.0.16 proofman
RogerTaule Dec 4, 2024
717cc59
update develop changes on feature/input_sm
zkronos73 Dec 4, 2024
593f2e4
fix minor bug after update develop changes
zkronos73 Dec 4, 2024
9210d8e
fix bug on additional mem calculation
zkronos73 Dec 4, 2024
93edaa2
WIP memory patest ore than 1 segment
zkronos73 Dec 5, 2024
11af650
WIP debug memory continuations
zkronos73 Dec 5, 2024
22573c8
WIP updates and fix for new pil2-proofman version
zkronos73 Dec 5, 2024
aaa8e6f
WIP memory integration
zkronos73 Dec 6, 2024
afa35ac
update direct_global continuations
zkronos73 Dec 9, 2024
fade474
update mem pil comments
zkronos73 Dec 9, 2024
29bbbc4
cargo fmt
zkronos73 Dec 9, 2024
6ecb87c
cargo clippy
zkronos73 Dec 9, 2024
eb1949c
update pil and remove some println
zkronos73 Dec 10, 2024
c97748f
fix last bugs on memory, added documentation
zkronos73 Dec 10, 2024
158cb57
fix cargo clippy warnings
zkronos73 Dec 11, 2024
096cf00
Merge branch 'develop-v0.1.0' into feature/input_sm
zkronos73 Dec 11, 2024
b8fcc4a
update input_sm with develop-v0.1.0 changes
zkronos73 Dec 11, 2024
69c0434
fix bug on traces
zkronos73 Dec 11, 2024
ac334dd
update with develop-v0.1.0 changes
zkronos73 Dec 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/target
/*.tar.gz
/riscof
/build
/proofs
/build*
/proofs*
*.pilout
/tmp
*.log
*.log
4 changes: 4 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 48 additions & 11 deletions core/src/elf2rom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,15 @@ pub fn elf2rom(elf_file: String) -> Result<ZiskRom, Box<dyn Error>> {
for section_header in section_headers {
// Consider only the section headers that contain program data
if section_header.sh_type == SHT_PROGBITS {
// Get the program section data as a vector of bytes
// Get the section header address
let addr = section_header.sh_addr;

// Ignore sections with address = 0, as per ELF spec
if addr == 0 {
continue;
}

// Get the section data
let (data_u8, _) = elf_bytes.section_data(&section_header)?;
let mut data = data_u8.to_vec();

Expand All @@ -37,31 +45,58 @@ pub fn elf2rom(elf_file: String) -> Result<ZiskRom, Box<dyn Error>> {
data.pop();
}

// Get the section data address
let addr = section_header.sh_addr;

// If the data contains instructions, parse them as RISC-V instructions and add them
// to the ROM instructions, at the specified program address
// If this is a code section, add it to program
if (section_header.sh_flags & SHF_EXECINSTR as u64) != 0 {
add_zisk_code(&mut rom, addr, &data);
}

// Add init data as a read/write memory section, initialized by code
// If the data is a writable memory section, add it to the ROM memory using Zisk
// copy instructions
if (section_header.sh_flags & SHF_WRITE as u64) != 0 &&
addr >= RAM_ADDR &&
addr + data.len() as u64 <= RAM_ADDR + RAM_SIZE
{
add_zisk_init_data(&mut rom, addr, &data);
// Otherwise, add it to the ROM as RO data
} else {
rom.ro_data.push(RoData::new(addr, data.len(), data));
//println! {"elf2rom() new RW from={:x} length={:x}={}", addr, data.len(),
//data.len()};
add_zisk_init_data(&mut rom, addr, &data, true);
}
// Add read-only data memory section
else {
// Search for an existing RO section previous to this one
let mut found = false;
for rd in rom.ro_data.iter_mut() {
// Section data should be previous to this one
if (rd.from + rd.length as u64) == addr {
rd.length += data.len();
rd.data.extend(data.clone());
found = true;
//println! {"elf2rom() adding RO from={:x} length={:x}={}", rd.from,
// rd.length, rd.length};
break;
}
}

// If not found, create a new RO section
if !found {
//println! {"elf2rom() new RO from={:x} length={:x}={}", addr, data.len(),
// data.len()};
rom.ro_data.push(RoData::new(addr, data.len(), data));
}
}
}
}
}

// Add the program setup, system call and program wrapup instructions
// Add RO data initialization code insctructions
let ro_data_len = rom.ro_data.len();
for i in 0..ro_data_len {
let addr = rom.ro_data[i].from;
let mut data = Vec::new();
data.extend(rom.ro_data[i].data.as_slice());
add_zisk_init_data(&mut rom, addr, &data, true);
}

add_entry_exit_jmp(&mut rom, elf_bytes.ehdr.e_entry);

// Preprocess the ROM (experimental)
Expand Down Expand Up @@ -128,6 +163,8 @@ pub fn elf2rom(elf_file: String) -> Result<ZiskRom, Box<dyn Error>> {
}
}

//println! {"elf2rom() got rom.insts.len={}", rom.insts.len()};

Ok(rom)
}

Expand Down
Loading
Loading