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

LAB2 Build Fail Error #33

Closed
JongyCysec opened this issue Oct 8, 2024 · 1 comment
Closed

LAB2 Build Fail Error #33

JongyCysec opened this issue Oct 8, 2024 · 1 comment
Assignees
Labels
bug Internal compiler error in HazardFlow homework - branch-predictor Assignment 2: Branch Predictor question Further information is requested

Comments

@JongyCysec
Copy link

JongyCysec commented Oct 8, 2024

Fail Case 1 (using foreign crate)

In the implementation of bht and btb, I've used clog2 function in order to calculate bit width corresponding to BHT_ENTRIES or BTB_ENTRIES.
However, it caused error like below.

thread 'rustc' panicked at hazardflow/src/compiler/pure/build_expr_ast.rs:731:77:
unimplemented

So I suspect that using foreign function like clog2 should be refrained.

Fail Case 2 (return statement)

If we end up function with return statement without any condition, then it raise build error as below.

thread 'rustc' panicked at hazardflow/src/compiler/pure/function.rs:741:25:
explicit return with no path conditions

So, we should also refrain from using pure return statement.
ex. return x; -> x

Fail Case 3 (into trait)

I tried to add pc and imm whose types are u32 and U<N>.
So, I tried to change the type of imm into u32 by using .into(). But I suspect that compiler prohibited using into trait.

thread 'rustc' panicked at hazardflow/src/compiler/pure/build_expr_ast.rs:765:25:
not yet implemented: Implement Into trait

Therefore, finally I've used from trait instead.

@minseongg
Copy link
Member

minseongg commented Oct 8, 2024

Sorry.. it seems the current HazardFlow compiler is immature, there are some unimplemented features.

For the first failure case, the clog2() function can only be used in const generic parameters. To workaround the failure case, please use APIs that can use clog2() within the const generics. For example, if you are calculating index bits, you can use clip_const::<M>(index) API, where M is an { clog2(ENTRIES) }.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Internal compiler error in HazardFlow homework - branch-predictor Assignment 2: Branch Predictor question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants