Nanopass in Common Lisp

62 views
Skip to first unread message

Karl Hallsby

unread,
Jul 24, 2023, 3:12:29 PM7/24/23
to nanopass-framework
I have been kicking an idea around for an HDL toolchain for some time now. As part of the lowering process, optimizations happen at various levels of description of a circuit.

I would like to use the nanopass framework for some of these kinds of optimizations. However, I am currently doing this in Common Lisp to support dynamic generation of core images of the Lisp process.

My question is, how feasible is it to implement a nanopass framework in Common Lisp? I want everything to remain in Common Lisp to create a uniform environment for working with hardware, everything from the hardware language to the simulator would be written in Common Lisp.

To be clear, I am fine dumping a hardware description to a separate file for the Racket or Scheme versions to optimize, but would like to reduce the number of languages used.

Andy Keep

unread,
Aug 6, 2023, 7:39:26 PM8/6/23
to Karl Hallsby, nanopass-framework
Hey Karl,

I think it should be possible to implement the nanopass framework in Common Lisp. Essentially, the two main forms of the framework `define-language` and `define-pass` need a way to store and retrieve language definitions at compile-time to allow for the language and language extension definitions and to write the boilerplate code in passes that specify an input language and output language. This is done in Scheme using the compile-time environment exposed through the macro system, but you could imagine using a compile-time hash table or using “leap-frogging macros” where the expansion of “define-language” expanded into a macro that could be used in the expansion of define-language and define-pass.

That said, it will be some work to port all of it over, so it might be expedient to use the Scheme or Racket version. Unfortunately, I don’t have the spare time to look at porting to Common Lisp myself.

-andy:)

--
You received this message because you are subscribed to the Google Groups "nanopass-framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nanopass-framew...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nanopass-framework/368c6731-97de-43eb-a125-a91aaf763cb3n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages