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

Constants tracking issue #19

Open
5 of 10 tasks
VonTum opened this issue Nov 2, 2024 · 1 comment
Open
5 of 10 tasks

Constants tracking issue #19

VonTum opened this issue Nov 2, 2024 · 1 comment
Labels
enhancement New feature or request Request Input These are issues about the design of the language, and thus should be discussed

Comments

@VonTum
Copy link
Collaborator

VonTum commented Nov 2, 2024

Constants are SUS's way of building compile-time functions.

// Basic builtin constants
__builtin__ const bool false {}
__builtin__ const bool true {}
const int HUNDRED_PI {HUNDRED_PI = 314}

// But also, compiletime functions, and builtins like
__builtin__ const int sizeof #(T) {}
const int factorial #(int num) {
  factorial = 1
  for i in 1..num {
    factorial = factorial * i
  }
}

Basic:

  • Parser
  • Initialization
  • Flattened
  • Typecheck
  • Get constant value in execute
  • Built-in Constants taking parameters (int sizeof #(T), int clog2 #(int V))

Custom compile-time functions

  • Updating flattening such that the instructions within const are all generative
  • Updating abstract typecheck to pass over const (not a big deal, since everything's shared in LinkInfo)
  • Updating Execute, such that it can call other execute instances recursively to evaluate constants
  • Updating tree-walk to show the content of const (and maybe struct too, if we're editing that anyhow, most code would be shared)
@VonTum VonTum added enhancement New feature or request Request Input These are issues about the design of the language, and thus should be discussed labels Nov 2, 2024
@VonTum
Copy link
Collaborator Author

VonTum commented Nov 13, 2024

Add Verilog's $clog2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Request Input These are issues about the design of the language, and thus should be discussed
Projects
None yet
Development

No branches or pull requests

1 participant