Skip to content

Instantly share code, notes, and snippets.

@thoughtpolice
Created August 19, 2021 08:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thoughtpolice/de3510502a94776d187f21afb09257e8 to your computer and use it in GitHub Desktop.
Save thoughtpolice/de3510502a94776d187f21afb09257e8 to your computer and use it in GitHub Desktop.
#! /usr/bin/env bluetcl
# bsc-libdir: a tcl script that looks up Verilog primitives for
# the bluespec compiler, and emits them to stdout. this tool
# is more useful when combined with `bsc-rpc`, but might be
# of use on its own.
#
# usage:
#
# $ bluetcl bsc-libdir RegUN > RegUN.v
# $ bluetcl bsc-libdir BRAM1Load > BRAM1Load.v
if { $argc != 1 } {
puts "ERROR: module name must be provided"
exit 1
}
set vmod [lindex $argv 0]
set modpath "${env(BLUESPECDIR)}/Verilog/${vmod}.v"
if { [file exist "${modpath}"] != 1 } {
puts "ERROR: bluespec primitive module ${vmod} does not exist!"
exit 1
}
set fp [open $modpath r]
set contents [read $fp]
close $fp
puts -nonewline "${contents}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment