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

Add powdr- prefix to crate names #921

Merged
merged 1 commit into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@ members = [
"powdr",
"number",
"parser",
"powdr_cli",
"cli",
"executor",
"riscv",
"parser_util",
"pil_analyzer",
"parser-util",
"pil-analyzer",
"pipeline",
"pilopt",
"asm_to_pil",
"asm-to-pil",
"halo2",
"backend",
"ast",
"analysis",
"linker",
"asm_utils",
"asm-utils",
"airgen",
"riscv_executor",
"riscv-executor",
]

exclude = [ "powdr_riscv_rt" ]
exclude = [ "riscv-rt" ]

[patch."https://github.com/privacy-scaling-explorations/halo2.git"]
# TODO change back to this once the PR is merged
Expand Down
9 changes: 5 additions & 4 deletions airgen/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
[package]
name = "airgen"
name = "powdr-airgen"
version = "0.1.0"
edition = "2021"

[dependencies]
log = "0.4.17"
number = { path = "../number" }
powdr-ast = { path = "../ast" }
powdr-number = { path = "../number" }

num-bigint = "0.4.3"
ast = { path = "../ast" }
log = "0.4.17"
8 changes: 4 additions & 4 deletions airgen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use std::collections::BTreeMap;

use ast::{
use powdr_ast::{
asm_analysis::{AnalysisASMFile, Item, LinkDefinitionStatement, SubmachineDeclaration},
object::{Link, LinkFrom, LinkTo, Location, Object, Operation, PILGraph},
parsed::{
Expand All @@ -16,7 +16,7 @@ use ast::{
const MAIN_MACHINE: &str = "::Main";
const MAIN_FUNCTION: &str = "main";

use number::FieldElement;
use powdr_number::FieldElement;

pub fn compile<T: FieldElement>(input: AnalysisASMFile<T>) -> PILGraph<T> {
let main_location = Location::main();
Expand Down Expand Up @@ -71,7 +71,7 @@ pub fn compile<T: FieldElement>(input: AnalysisASMFile<T>) -> PILGraph<T> {
panic!()
};

let main = ast::object::Machine {
let main = powdr_ast::object::Machine {
location: main_location,
latch: main_ty.latch.clone(),
operation_id: main_ty.operation_id.clone(),
Expand Down Expand Up @@ -204,7 +204,7 @@ impl<'a, T: FieldElement> ASMPILConverter<'a, T> {
.operation_definitions()
.find(|o| o.name == callable)
.map(|d| LinkTo {
machine: ast::object::Machine {
machine: powdr_ast::object::Machine {
location: instance_location,
latch: instance_ty.latch.clone(),
operation_id: instance_ty.operation_id.clone(),
Expand Down
14 changes: 7 additions & 7 deletions analysis/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
[package]
name = "analysis"
name = "powdr-analysis"
version = "0.1.0"
edition = "2021"

[dependencies]
ast = { path = "../ast" }
powdr-asm-to-pil = { path = "../asm-to-pil" }
powdr-ast = { path = "../ast" }
powdr-number = { path = "../number" }
powdr-parser = { path = "../parser" }

itertools = "^0.10"
log = "0.4.18"
number = { path = "../number" }
parser = { path = "../parser" }
asm_to_pil = { path = "../asm_to_pil" }

[dev-dependencies]
parser = { path = "../parser" }
importer = { path = "../importer" }
powdr-importer = { path = "../importer" }
pretty_assertions = "1.3.0"
test-log = "0.2.12"
env_logger = "0.10.0"
4 changes: 2 additions & 2 deletions analysis/src/block_enforcer.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! For all machines, enforce that the `operation_id` can only change when the `latch` is on
use ast::asm_analysis::AnalysisASMFile;
use number::FieldElement;
use powdr_ast::asm_analysis::AnalysisASMFile;
use powdr_number::FieldElement;

use crate::utils::parse_pil_statement;

Expand Down
14 changes: 7 additions & 7 deletions analysis/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ mod block_enforcer;
pub mod machine_check;
mod vm;

use ast::{asm_analysis::AnalysisASMFile, parsed::asm::ASMProgram, DiffMonitor};
use number::FieldElement;
use powdr_ast::{asm_analysis::AnalysisASMFile, parsed::asm::ASMProgram, DiffMonitor};
use powdr_number::FieldElement;

pub fn convert_asm_to_pil<T: FieldElement>(
file: ASMProgram<T>,
Expand Down Expand Up @@ -39,7 +39,7 @@ pub fn convert_vms_to_constrained<T: FieldElement>(
) -> AnalysisASMFile<T> {
// remove all asm (except external instructions)
log::debug!("Run asm_to_pil");
let file = asm_to_pil::compile(file);
let file = powdr_asm_to_pil::compile(file);
monitor.push(&file);

// enforce blocks using `operation_id` and `latch`
Expand All @@ -51,12 +51,12 @@ pub fn convert_vms_to_constrained<T: FieldElement>(
}

pub mod utils {
use ast::parsed::PilStatement;
use number::FieldElement;
use powdr_ast::parsed::PilStatement;
use powdr_number::FieldElement;

pub fn parse_pil_statement<T: FieldElement>(input: &str) -> PilStatement<T> {
let ctx = parser::ParserContext::new(None, input);
parser::powdr::PilStatementParser::new()
let ctx = powdr_parser::ParserContext::new(None, input);
powdr_parser::powdr::PilStatementParser::new()
.parse(&ctx, input)
.unwrap()
}
Expand Down
14 changes: 7 additions & 7 deletions analysis/src/machine_check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use std::{collections::BTreeMap, marker::PhantomData};

use ast::{
use powdr_ast::{
asm_analysis::{
AnalysisASMFile, AssignmentStatement, CallableSymbolDefinitions, DebugDirective,
DegreeStatement, FunctionBody, FunctionStatements, FunctionSymbol, Instruction,
Expand All @@ -19,7 +19,7 @@ use ast::{
},
},
};
use number::FieldElement;
use powdr_number::FieldElement;

/// Verifies certain properties of each machine and constructs the Machine objects.
/// Also transfers generic PIL definitions but does not verify anything about them.
Expand Down Expand Up @@ -323,9 +323,9 @@ impl<T: FieldElement> TypeChecker<T> {
let errors: Vec<_> = statements
.iter()
.filter_map(|s| match s {
ast::parsed::PilStatement::PolynomialIdentity(_, _) => None,
ast::parsed::PilStatement::PermutationIdentity(_, l, _)
| ast::parsed::PilStatement::PlookupIdentity(_, l, _) => l
powdr_ast::parsed::PilStatement::PolynomialIdentity(_, _) => None,
powdr_ast::parsed::PilStatement::PermutationIdentity(_, l, _)
| powdr_ast::parsed::PilStatement::PlookupIdentity(_, l, _) => l
.selector
.is_some()
.then_some(format!("LHS selector not yet supported in {s}.")),
Expand All @@ -345,8 +345,8 @@ impl<T: FieldElement> TypeChecker<T> {

#[cfg(test)]
mod tests {
use importer::load_dependencies_and_resolve_str;
use number::Bn254Field;
use powdr_importer::load_dependencies_and_resolve_str;
use powdr_number::Bn254Field;

use super::check;

Expand Down
10 changes: 5 additions & 5 deletions analysis/src/vm/batcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
use std::marker::PhantomData;

use ast::{
use itertools::Itertools;
use powdr_ast::{
asm_analysis::{
AnalysisASMFile, BatchMetadata, FunctionStatement, Incompatible, IncompatibleSet, Item,
Machine,
},
parsed::asm::AbsoluteSymbolPath,
};
use itertools::Itertools;
use number::FieldElement;
use powdr_number::FieldElement;

pub fn batch<T: FieldElement>(file: AnalysisASMFile<T>) -> AnalysisASMFile<T> {
RomBatcher::default().batch(file)
Expand Down Expand Up @@ -153,8 +153,8 @@ mod tests {

use std::{fs, path::PathBuf};

use ast::asm_analysis::AnalysisASMFile;
use number::GoldilocksField;
use powdr_ast::asm_analysis::AnalysisASMFile;
use powdr_number::GoldilocksField;
use pretty_assertions::assert_eq;
use test_log::test;

Expand Down
8 changes: 4 additions & 4 deletions analysis/src/vm/inference.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
//! Infer assignment registers in asm statements
use ast::{
use powdr_ast::{
asm_analysis::{AnalysisASMFile, Expression, FunctionStatement, Item, Machine},
parsed::asm::AssignmentRegister,
};
use number::FieldElement;
use powdr_number::FieldElement;

pub fn infer<T: FieldElement>(file: AnalysisASMFile<T>) -> Result<AnalysisASMFile<T>, Vec<String>> {
let mut errors = vec![];
Expand Down Expand Up @@ -99,8 +99,8 @@ fn infer_machine<T: FieldElement>(mut machine: Machine<T>) -> Result<Machine<T>,

#[cfg(test)]
mod tests {
use ast::{asm_analysis::AssignmentStatement, parsed::asm::parse_absolute_path};
use number::Bn254Field;
use powdr_ast::{asm_analysis::AssignmentStatement, parsed::asm::parse_absolute_path};
use powdr_number::Bn254Field;

use crate::vm::test_utils::infer_str;

Expand Down
6 changes: 3 additions & 3 deletions analysis/src/vm/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! Analysis for VM machines, reducing them to constrained machines
//! Machines which do not have a pc should be left unchanged by this
use ast::{asm_analysis::AnalysisASMFile, DiffMonitor};
use number::FieldElement;
use powdr_ast::{asm_analysis::AnalysisASMFile, DiffMonitor};
use powdr_number::FieldElement;

pub mod batcher;
pub mod inference;
Expand Down Expand Up @@ -30,7 +30,7 @@ mod test_utils {
/// A test utility to process a source file until after inference
pub fn infer_str<T: FieldElement>(source: &str) -> Result<AnalysisASMFile<T>, Vec<String>> {
let machines =
crate::machine_check::check(importer::load_dependencies_and_resolve_str(source))
crate::machine_check::check(powdr_importer::load_dependencies_and_resolve_str(source))
.unwrap();
inference::infer(machines)
}
Expand Down
16 changes: 16 additions & 0 deletions asm-to-pil/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[package]
name = "powdr-asm-to-pil"
version = "0.1.0"
edition = "2021"

[dependencies]
powdr-ast = { path = "../ast" }
powdr-number = { path = "../number" }
powdr-parser = { path = "../parser" }

log = "0.4.17"
num-bigint = "0.4.3"
pretty_assertions = "1.4.0"

[dev-dependencies]
powdr-analysis = { path = "../analysis" }
4 changes: 2 additions & 2 deletions asm_to_pil/src/common.rs → asm-to-pil/src/common.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// Values which are common to many steps from asm to PIL
use number::FieldElement;
use powdr_number::FieldElement;

use crate::utils::parse_instruction;

Expand Down Expand Up @@ -31,7 +31,7 @@ pub fn output_at(i: usize) -> String {
pub fn return_instruction<T: FieldElement>(
output_count: usize,
pc_name: &str,
) -> ast::asm_analysis::Instruction<T> {
) -> powdr_ast::asm_analysis::Instruction<T> {
parse_instruction(&format!(
"{} {{ {pc_name}' = 0 }}",
output_registers(output_count).join(", ")
Expand Down
Loading
Loading