Mechanical rename of cirt -> circt.

This commit is contained in:
Chris Lattner 2020-06-17 10:19:08 -07:00
parent 1cf925f263
commit 3202062646
76 changed files with 311 additions and 309 deletions

View File

@ -8,7 +8,7 @@
"${workspaceFolder}/../llvm-project/llvm/include",
"${workspaceFolder}/../llvm-project/build/include",
"${workspaceFolder}/../llvm-project/build/tools/mlir/include",
"${workspaceFolder}/../llvm-project/build/tools/cirt/include"
"${workspaceFolder}/../llvm-project/build/tools/circt/include"
],
"defines": [],
"macFrameworkPath": [

View File

@ -1,9 +1,9 @@
# CIRT project.
set(CIRT_MAIN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include ) # --src-root
set(CIRT_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/include ) # --includedir
# CIRCT project.
set(CIRCT_MAIN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include ) # --src-root
set(CIRCT_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/include ) # --includedir
set(CIRT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(CIRT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
set(CIRCT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(CIRCT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
@ -18,30 +18,30 @@ set(MLIR_BINARY_INCLUDE_DIR ${LLVM_TOOLS_BINARY_DIR}/../tools/mlir/include )
# Installing the headers and docs needs to depend on generating any public
# tablegen'd targets.
add_custom_target(cirt-headers)
set_target_properties(cirt-headers PROPERTIES FOLDER "Misc")
add_custom_target(cirt-doc)
add_custom_target(circt-headers)
set_target_properties(circt-headers PROPERTIES FOLDER "Misc")
add_custom_target(circt-doc)
include_directories( ${MLIR_INCLUDE_DIR})
include_directories( ${MLIR_BINARY_INCLUDE_DIR})
include_directories( ${CIRT_INCLUDE_DIR})
include_directories( ${CIRT_MAIN_SRC_DIR})
include_directories( ${CIRCT_INCLUDE_DIR})
include_directories( ${CIRCT_MAIN_SRC_DIR})
add_subdirectory(include/cirt)
add_subdirectory(include/circt)
add_subdirectory(lib)
add_subdirectory(tools)
#add_subdirectory(unittests)
add_subdirectory(test)
#option(CIRT_INCLUDE_DOCS "Generate build targets for the CIRT docs."
#option(CIRCT_INCLUDE_DOCS "Generate build targets for the CIRCT docs."
# ${LLVM_INCLUDE_DOCS} ${MLIR_INCLUDE_DOCS})
#if (CIRT_INCLUDE_DOCS)
#if (CIRCT_INCLUDE_DOCS)
# add_subdirectory(docs)
#endif()
install(DIRECTORY include/cirt
install(DIRECTORY include/circt
DESTINATION include
COMPONENT cirt-headers
COMPONENT circt-headers
FILES_MATCHING
PATTERN "*.def"
PATTERN "*.h"
@ -50,9 +50,9 @@ install(DIRECTORY include/cirt
PATTERN "LICENSE.TXT"
)
install(DIRECTORY ${CIRT_INCLUDE_DIR}/cirt
install(DIRECTORY ${CIRCT_INCLUDE_DIR}/circt
DESTINATION include
COMPONENT cirt-headers
COMPONENT circt-headers
FILES_MATCHING
PATTERN "*.def"
PATTERN "*.h"
@ -64,9 +64,9 @@ install(DIRECTORY ${CIRT_INCLUDE_DIR}/cirt
)
if (NOT LLVM_ENABLE_IDE)
add_llvm_install_targets(install-cirt-headers
DEPENDS cirt-headers
COMPONENT cirt-headers)
add_llvm_install_targets(install-circt-headers
DEPENDS circt-headers
COMPONENT circt-headers)
endif()
add_subdirectory(cmake/modules)

View File

@ -1,9 +1,9 @@
# "CIRT" / Circuit IR and Tools
# "CIRCT" / Circuit IR Compilers and Tools
This is an experimental repository, applying the MLIR/LLVM approach to building
modular tools for Verilog, focusing on FIRRTL.
"CIRT" stands for "Circuit IR and Tools" or perhaps "CIRCuiT +
"CIRCT" stands for "Circuit IR Compilers and Tools" or perhaps "CIRCuiT +
IntermediateRepresenTation + Toolbox" (hat tip to Aliaksei Chapyzhenka). The
T can be further expanded as Tool, Translator, Team, Tech, Target, Tree, Type,
... This name can still be changed if a better one is suggested. :-)
@ -15,31 +15,31 @@ These are the commands Chris used to set this up on a Mac:
1) Install Dependences of LLVM/MLIR according to [the
instructions](https://mlir.llvm.org/getting_started/), including cmake and ninja.
2) Check out LLVM and CIRT repo's:
2) Check out LLVM and CIRCT repo's:
```
$ cd ~/Projects
$ git clone git@github.com:llvm/llvm-project.git
$ git clone git@github.com:sifive/cirt.git cirt
$ git clone git@github.com:sifive/circt.git circt
```
3) HACK: Add symlink because I can't figure out how to get
`LLVM_EXTERNAL_CIRT_SOURCE_DIR` to work with cmake (I'd love help with
`LLVM_EXTERNAL_CIRCT_SOURCE_DIR` to work with cmake (I'd love help with
this!):
```
$ cd ~/Projects/llvm-project
$ ln -s ../cirt cirt
$ ln -s ../circt circt
```
4) Configure the build to build MLIR and CIRT using a command like this
4) Configure the build to build MLIR and CIRCT using a command like this
(replace `/Users/chrisl` with the paths you want to use):
```
$ cd ~/Projects/llvm-project
$ mkdir build
$ cd build
$ cmake -G Ninja ../llvm -DLLVM_EXTERNAL_PROJECTS="cirt" -DLLVM_EXTERNAL_CIRT_SOURCE_DIR=/Users/chrisl/Projects/cirt -DLLVM_ENABLE_PROJECTS="mlir;cirt" -DLLVM_TARGETS_TO_BUILD="X86;RISCV" -DLLVM_ENABLE_ASSERTIONS=ON -DCMAKE_BUILD_TYPE=DEBUG
$ cmake -G Ninja ../llvm -DLLVM_EXTERNAL_PROJECTS="circt" -DLLVM_EXTERNAL_CIRCT_SOURCE_DIR=/Users/chrisl/Projects/circt -DLLVM_ENABLE_PROJECTS="mlir;circt" -DLLVM_TARGETS_TO_BUILD="X86;RISCV" -DLLVM_ENABLE_ASSERTIONS=ON -DCMAKE_BUILD_TYPE=DEBUG
```
The `-DCMAKE_BUILD_TYPE=DEBUG` flag enables debug information, which makes the
@ -58,16 +58,16 @@ reasonably fast and a good sanity check:
$ ninja check-mlir
```
6) Build CIRT and run CIRT tests:
6) Build CIRCT and run CIRCT tests:
```
$ ninja check-cirt
$ ninja check-circt
```
7) Optionally configure your environment:
It is useful to add the .../llvm-project/build/bin directory to the end
of your PATH, allowing you to use the tools like cirt-opt in a natural way on
of your PATH, allowing you to use the tools like circt-opt in a natural way on
the command line. Similarly, you need to be in the build directory to invoke
ninja, which is super annoying. You might find a bash/zsh alias like this to
be useful:
@ -78,10 +78,10 @@ build() {
}
```
This allows you to invoke `build check-cirt` from any directory and have it do
This allows you to invoke `build check-circt` from any directory and have it do
the right thing.
## Submitting changes to CIRT
## Submitting changes to CIRCT
The project is small so there is no formal process yet. Just talk to Chris, or
create a PR.

View File

@ -1,67 +1,67 @@
# Generate a list of CMake library targets so that other CMake projects can
# link against them. LLVM calls its version of this file LLVMExports.cmake, but
# the usual CMake convention seems to be ${Project}Targets.cmake.
set(CIRT_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm)
set(cirt_cmake_builddir "${CMAKE_BINARY_DIR}/${CIRT_INSTALL_PACKAGE_DIR}")
set(CIRCT_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm)
set(circt_cmake_builddir "${CMAKE_BINARY_DIR}/${CIRCT_INSTALL_PACKAGE_DIR}")
# Keep this in sync with llvm/cmake/CMakeLists.txt!
set(LLVM_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm)
set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}")
get_property(CIRT_EXPORTS GLOBAL PROPERTY CIRT_EXPORTS)
export(TARGETS ${CIRT_EXPORTS} FILE ${cirt_cmake_builddir}/CIRTTargets.cmake)
get_property(CIRCT_EXPORTS GLOBAL PROPERTY CIRCT_EXPORTS)
export(TARGETS ${CIRCT_EXPORTS} FILE ${circt_cmake_builddir}/CIRCTTargets.cmake)
# Generate CIRTConfig.cmake for the build tree.
set(CIRT_CONFIG_CMAKE_DIR "${cirt_cmake_builddir}")
set(CIRT_CONFIG_LLVM_CMAKE_DIR "${llvm_cmake_builddir}")
set(CIRT_CONFIG_EXPORTS_FILE "${cirt_cmake_builddir}/CIRTTargets.cmake")
set(CIRT_CONFIG_INCLUDE_DIRS
"${CIRT_SOURCE_DIR}/include"
"${CIRT_BINARY_DIR}/include"
# Generate CIRCTConfig.cmake for the build tree.
set(CIRCT_CONFIG_CMAKE_DIR "${circt_cmake_builddir}")
set(CIRCT_CONFIG_LLVM_CMAKE_DIR "${llvm_cmake_builddir}")
set(CIRCT_CONFIG_EXPORTS_FILE "${circt_cmake_builddir}/CIRCTTargets.cmake")
set(CIRCT_CONFIG_INCLUDE_DIRS
"${CIRCT_SOURCE_DIR}/include"
"${CIRCT_BINARY_DIR}/include"
)
set(CIRT_CONFIG_CMAKE_DIR)
set(CIRT_CONFIG_LLVM_CMAKE_DIR)
set(CIRT_CONFIG_EXPORTS_FILE)
set(CIRCT_CONFIG_CMAKE_DIR)
set(CIRCT_CONFIG_LLVM_CMAKE_DIR)
set(CIRCT_CONFIG_EXPORTS_FILE)
# Generate CIRTConfig.cmake for the install tree.
set(CIRT_CONFIG_CODE "
# Generate CIRCTConfig.cmake for the install tree.
set(CIRCT_CONFIG_CODE "
# Compute the installation prefix from this LLVMConfig.cmake file location.
get_filename_component(CIRT_INSTALL_PREFIX \"\${CMAKE_CURRENT_LIST_FILE}\" PATH)")
get_filename_component(CIRCT_INSTALL_PREFIX \"\${CMAKE_CURRENT_LIST_FILE}\" PATH)")
# Construct the proper number of get_filename_component(... PATH)
# calls to compute the installation prefix.
string(REGEX REPLACE "/" ";" _count "${CIRT_INSTALL_PACKAGE_DIR}")
string(REGEX REPLACE "/" ";" _count "${CIRCT_INSTALL_PACKAGE_DIR}")
foreach(p ${_count})
set(CIRT_CONFIG_CODE "${CIRT_CONFIG_CODE}
get_filename_component(CIRT_INSTALL_PREFIX \"\${CIRT_INSTALL_PREFIX}\" PATH)")
set(CIRCT_CONFIG_CODE "${CIRCT_CONFIG_CODE}
get_filename_component(CIRCT_INSTALL_PREFIX \"\${CIRCT_INSTALL_PREFIX}\" PATH)")
endforeach(p)
set(CIRT_CONFIG_CMAKE_DIR "\${CIRT_INSTALL_PREFIX}/${CIRT_INSTALL_PACKAGE_DIR}")
set(CIRT_CONFIG_LLVM_CMAKE_DIR "\${CIRT_INSTALL_PREFIX}/${LLVM_INSTALL_PACKAGE_DIR}")
set(CIRT_CONFIG_EXPORTS_FILE "\${CIRT_CMAKE_DIR}/CIRTTargets.cmake")
set(CIRT_CONFIG_INCLUDE_DIRS
"\${CIRT_INSTALL_PREFIX}/include"
set(CIRCT_CONFIG_CMAKE_DIR "\${CIRCT_INSTALL_PREFIX}/${CIRCT_INSTALL_PACKAGE_DIR}")
set(CIRCT_CONFIG_LLVM_CMAKE_DIR "\${CIRCT_INSTALL_PREFIX}/${LLVM_INSTALL_PACKAGE_DIR}")
set(CIRCT_CONFIG_EXPORTS_FILE "\${CIRCT_CMAKE_DIR}/CIRCTTargets.cmake")
set(CIRCT_CONFIG_INCLUDE_DIRS
"\${CIRCT_INSTALL_PREFIX}/include"
)
set(CIRT_CONFIG_CODE)
set(CIRT_CONFIG_CMAKE_DIR)
set(CIRT_CONFIG_EXPORTS_FILE)
set(CIRCT_CONFIG_CODE)
set(CIRCT_CONFIG_CMAKE_DIR)
set(CIRCT_CONFIG_EXPORTS_FILE)
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
# Not TOOLCHAIN ONLY, so install the CIRT parts as well
# Include the cmake files so other tools can use cirt-tblgen, etc.
get_property(cirt_has_exports GLOBAL PROPERTY CIRT_HAS_EXPORTS)
if(cirt_has_exports)
install(EXPORT CIRTTargets DESTINATION ${CIRT_INSTALL_PACKAGE_DIR}
COMPONENT cirt-cmake-exports)
# Not TOOLCHAIN ONLY, so install the CIRCT parts as well
# Include the cmake files so other tools can use circt-tblgen, etc.
get_property(circt_has_exports GLOBAL PROPERTY CIRCT_HAS_EXPORTS)
if(circt_has_exports)
install(EXPORT CIRCTTargets DESTINATION ${CIRCT_INSTALL_PACKAGE_DIR}
COMPONENT circt-cmake-exports)
endif()
install(FILES #${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CIRTConfig.cmake
${CMAKE_CURRENT_SOURCE_DIR}/AddCIRT.cmake
DESTINATION ${CIRT_INSTALL_PACKAGE_DIR}
COMPONENT cirt-cmake-exports)
install(FILES #${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CIRCTConfig.cmake
${CMAKE_CURRENT_SOURCE_DIR}/AddCIRCT.cmake
DESTINATION ${CIRCT_INSTALL_PACKAGE_DIR}
COMPONENT circt-cmake-exports)
if(NOT LLVM_ENABLE_IDE)
# Add a dummy target so this can be used with LLVM_DISTRIBUTION_COMPONENTS
add_custom_target(cirt-cmake-exports)
add_llvm_install_targets(install-cirt-cmake-exports
COMPONENT cirt-cmake-exports)
add_custom_target(circt-cmake-exports)
add_llvm_install_targets(install-circt-cmake-exports
COMPONENT circt-cmake-exports)
endif()
endif()

View File

@ -4,12 +4,12 @@
//
//===----------------------------------------------------------------------===//
#ifndef CIRT_DIALECT_FIRRTL_DIALECT_H
#define CIRT_DIALECT_FIRRTL_DIALECT_H
#ifndef CIRCT_DIALECT_FIRRTL_DIALECT_H
#define CIRCT_DIALECT_FIRRTL_DIALECT_H
#include "mlir/IR/Dialect.h"
namespace cirt {
namespace circt {
namespace firrtl {
using namespace mlir;
class FIRRTLType;
@ -37,9 +37,9 @@ StringAttr getFIRRTLNameAttr(ArrayRef<NamedAttribute> attrs);
void registerFIRRTLPasses();
} // namespace firrtl
} // namespace cirt
} // namespace circt
// Pull in all enum type definitions and utility function declarations.
#include "cirt/Dialect/FIRRTL/FIRRTLEnums.h.inc"
#include "circt/Dialect/FIRRTL/FIRRTLEnums.h.inc"
#endif // CIRT_DIALECT_FIRRTL_IR_DIALECT_H
#endif // CIRCT_DIALECT_FIRRTL_IR_DIALECT_H

View File

@ -4,17 +4,17 @@
//
//===----------------------------------------------------------------------===//
#ifndef CIRT_DIALECT_FIRRTL_OPS_H
#define CIRT_DIALECT_FIRRTL_OPS_H
#ifndef CIRCT_DIALECT_FIRRTL_OPS_H
#define CIRCT_DIALECT_FIRRTL_OPS_H
#include "cirt/Dialect/FIRRTL/Dialect.h"
#include "cirt/Dialect/FIRRTL/Types.h"
#include "circt/Dialect/FIRRTL/Dialect.h"
#include "circt/Dialect/FIRRTL/Types.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/FunctionSupport.h"
#include "mlir/IR/SymbolTable.h"
#include "mlir/Interfaces/SideEffectInterfaces.h"
namespace cirt {
namespace circt {
namespace firrtl {
/// Return true if the specified operation is a firrtl expression.
@ -53,15 +53,15 @@ FunctionType getModuleType(Operation *op);
void getModulePortInfo(Operation *op, SmallVectorImpl<ModulePortInfo> &results);
} // namespace firrtl
} // namespace cirt
} // namespace circt
namespace cirt {
namespace circt {
namespace firrtl {
#define GET_OP_CLASSES
#include "cirt/Dialect/FIRRTL/FIRRTL.h.inc"
#include "circt/Dialect/FIRRTL/FIRRTL.h.inc"
} // namespace firrtl
} // namespace cirt
} // namespace circt
#endif // CIRT_DIALECT_FIRRTL_OPS_H
#endif // CIRCT_DIALECT_FIRRTL_OPS_H

View File

@ -10,8 +10,8 @@
//
//===----------------------------------------------------------------------===//
#ifndef CIRT_DIALECT_FIRRTL_PASSES_H
#define CIRT_DIALECT_FIRRTL_PASSES_H
#ifndef CIRCT_DIALECT_FIRRTL_PASSES_H
#define CIRCT_DIALECT_FIRRTL_PASSES_H
#include <memory>
@ -19,12 +19,12 @@ namespace mlir {
class Pass;
} // namespace mlir
namespace cirt {
namespace circt {
namespace firrtl {
std::unique_ptr<mlir::Pass> createLowerFIRRTLToRTLPass();
} // namespace firrtl
} // namespace cirt
} // namespace circt
#endif // CIRT_DIALECT_FIRRTL_PASSES_H
#endif // CIRCT_DIALECT_FIRRTL_PASSES_H

View File

@ -4,14 +4,14 @@
//
//===----------------------------------------------------------------------===//
#ifndef CIRT_DIALECT_FIRRTL_PASSES_TD
#define CIRT_DIALECT_FIRRTL_PASSES_TD
#ifndef CIRCT_DIALECT_FIRRTL_PASSES_TD
#define CIRCT_DIALECT_FIRRTL_PASSES_TD
include "mlir/Pass/PassBase.td"
def LowerFIRRTLToRTL : Pass<"lower-firrtl-to-rtl", "firrtl::FModuleOp"> {
let summary = "Lower FIRRTL to RTL";
let constructor = "cirt::firrtl::createLowerFIRRTLToRTLPass()";
let constructor = "circt::firrtl::createLowerFIRRTLToRTLPass()";
}
#endif // CIRT_DIALECT_FIRRTL_PASSES_TD
#endif // CIRCT_DIALECT_FIRRTL_PASSES_TD

View File

@ -4,12 +4,12 @@
//
//===----------------------------------------------------------------------===//
#ifndef CIRT_DIALECT_FIRRTL_TYPES_H
#define CIRT_DIALECT_FIRRTL_TYPES_H
#ifndef CIRCT_DIALECT_FIRRTL_TYPES_H
#define CIRCT_DIALECT_FIRRTL_TYPES_H
#include "mlir/IR/Types.h"
namespace cirt {
namespace circt {
namespace firrtl {
namespace detail {
struct WidthTypeStorage;
@ -275,14 +275,14 @@ public:
};
} // namespace firrtl
} // namespace cirt
} // namespace circt
namespace llvm {
// Type hash just like pointers.
template <>
struct DenseMapInfo<cirt::firrtl::FIRRTLType> {
using FIRRTLType = cirt::firrtl::FIRRTLType;
struct DenseMapInfo<circt::firrtl::FIRRTLType> {
using FIRRTLType = circt::firrtl::FIRRTLType;
static FIRRTLType getEmptyKey() {
auto pointer = llvm::DenseMapInfo<void *>::getEmptyKey();
return FIRRTLType(static_cast<mlir::Type::ImplType *>(pointer));
@ -297,4 +297,4 @@ struct DenseMapInfo<cirt::firrtl::FIRRTLType> {
} // namespace llvm
#endif // CIRT_DIALECT_FIRRTL_TYPES_H
#endif // CIRCT_DIALECT_FIRRTL_TYPES_H

View File

@ -4,13 +4,13 @@
//
//===----------------------------------------------------------------------===//
#ifndef CIRT_DIALECT_FIRRTL_VISITORS_H
#define CIRT_DIALECT_FIRRTL_VISITORS_H
#ifndef CIRCT_DIALECT_FIRRTL_VISITORS_H
#define CIRCT_DIALECT_FIRRTL_VISITORS_H
#include "cirt/Dialect/FIRRTL/Ops.h"
#include "circt/Dialect/FIRRTL/Ops.h"
#include "llvm/ADT/TypeSwitch.h"
namespace cirt {
namespace circt {
namespace firrtl {
/// ExprVisitor is a visitor for FIRRTL expression nodes.
@ -227,6 +227,6 @@ public:
};
} // namespace firrtl
} // namespace cirt
} // namespace circt
#endif // CIRT_DIALECT_FIRRTL_VISITORS_H
#endif // CIRCT_DIALECT_FIRRTL_VISITORS_H

View File

@ -4,12 +4,12 @@
//
//===----------------------------------------------------------------------===//
#ifndef CIRT_DIALECT_RTL_DIALECT_H
#define CIRT_DIALECT_RTL_DIALECT_H
#ifndef CIRCT_DIALECT_RTL_DIALECT_H
#define CIRCT_DIALECT_RTL_DIALECT_H
#include "mlir/IR/Dialect.h"
namespace cirt {
namespace circt {
namespace rtl {
using namespace mlir;
@ -25,6 +25,6 @@ public:
};
} // namespace rtl
} // namespace cirt
} // namespace circt
#endif // CIRT_DIALECT_RTL_DIALECT_H
#endif // CIRCT_DIALECT_RTL_DIALECT_H

View File

@ -4,23 +4,23 @@
//
//===----------------------------------------------------------------------===//
#ifndef CIRT_DIALECT_RTL_OPS_H
#define CIRT_DIALECT_RTL_OPS_H
#ifndef CIRCT_DIALECT_RTL_OPS_H
#define CIRCT_DIALECT_RTL_OPS_H
#include "cirt/Dialect/RTL/Dialect.h"
#include "circt/Dialect/RTL/Dialect.h"
#include "mlir/IR/OpImplementation.h"
#include "mlir/Interfaces/SideEffectInterfaces.h"
namespace cirt {
namespace circt {
namespace rtl {
#define GET_OP_CLASSES
#include "cirt/Dialect/RTL/RTL.h.inc"
#include "circt/Dialect/RTL/RTL.h.inc"
/// Return true if the specified operation is a combinatorial logic op.
bool isCombinatorial(Operation *op);
} // namespace rtl
} // namespace cirt
} // namespace circt
#endif // CIRT_DIALECT_RTL_OPS_H
#endif // CIRCT_DIALECT_RTL_OPS_H

View File

@ -4,13 +4,13 @@
//
//===----------------------------------------------------------------------===//
#ifndef CIRT_DIALECT_RTL_VISITORS_H
#define CIRT_DIALECT_RTL_VISITORS_H
#ifndef CIRCT_DIALECT_RTL_VISITORS_H
#define CIRCT_DIALECT_RTL_VISITORS_H
#include "cirt/Dialect/RTL/Ops.h"
#include "circt/Dialect/RTL/Ops.h"
#include "llvm/ADT/TypeSwitch.h"
namespace cirt {
namespace circt {
namespace rtl {
/// This helps visit Combinatorial nodes.
@ -78,6 +78,6 @@ public:
};
} // namespace rtl
} // namespace cirt
} // namespace circt
#endif // CIRT_DIALECT_RTL_VISITORS_H
#endif // CIRCT_DIALECT_RTL_VISITORS_H

View File

@ -4,22 +4,22 @@
//
//===----------------------------------------------------------------------===//
#ifndef CIRT_EMIT_VERILOG_H
#define CIRT_EMIT_VERILOG_H
#ifndef CIRCT_EMIT_VERILOG_H
#define CIRCT_EMIT_VERILOG_H
#include "cirt/Support/LLVM.h"
#include "circt/Support/LLVM.h"
namespace mlir {
struct LogicalResult;
class ModuleOp;
} // namespace mlir
namespace cirt {
namespace circt {
mlir::LogicalResult emitVerilog(mlir::ModuleOp module, llvm::raw_ostream &os);
void registerVerilogEmitterTranslation();
} // namespace cirt
} // namespace circt
#endif // CIRT_EMIT_VERILOG_H
#endif // CIRCT_EMIT_VERILOG_H

View File

@ -4,8 +4,8 @@
//
//===----------------------------------------------------------------------===//
#ifndef CIRT_DIALECT_FIRPARSER_H
#define CIRT_DIALECT_FIRPARSER_H
#ifndef CIRCT_DIALECT_FIRPARSER_H
#define CIRCT_DIALECT_FIRPARSER_H
namespace llvm {
class SourceMgr;
@ -16,7 +16,7 @@ class MLIRContext;
class OwningModuleRef;
} // namespace mlir
namespace cirt {
namespace circt {
struct FIRParserOptions {
/// If this is set to true, the @info locators are ignored, and the locations
@ -29,6 +29,6 @@ mlir::OwningModuleRef parseFIRFile(llvm::SourceMgr &sourceMgr,
FIRParserOptions options = {});
void registerFIRParserTranslation();
} // namespace cirt
} // namespace circt
#endif // CIRT_DIALECT_FIRPARSER_H
#endif // CIRCT_DIALECT_FIRPARSER_H

View File

@ -3,20 +3,20 @@
// This file forward declares and imports various common LLVM and MLIR datatypes
// that we want to use unqualified.
//
// Note that most of these are forward declared and then imported into the cirt
// Note that most of these are forward declared and then imported into the circt
// namespace with using decls, rather than being #included. This is because we
// want clients to explicitly #include the files they need.
//
//===----------------------------------------------------------------------===//
#ifndef CIRT_SUPPORT_LLVM_H
#define CIRT_SUPPORT_LLVM_H
#ifndef CIRCT_SUPPORT_LLVM_H
#define CIRCT_SUPPORT_LLVM_H
// MLIR includes a lot of forward declarations of LLVM types, use them.
#include "mlir/Support/LLVM.h"
// Import things we want into our namespace.
namespace cirt {
namespace circt {
// Casting operators.
using llvm::cast;
using llvm::cast_or_null;
@ -55,6 +55,6 @@ using llvm::Twine;
using llvm::APFloat;
using llvm::APInt;
using llvm::raw_ostream;
} // namespace cirt
} // namespace circt
#endif // CIRT_SUPPORT_LLVM_H
#endif // CIRCT_SUPPORT_LLVM_H

View File

@ -3,7 +3,7 @@ add_mlir_dialect_library(MLIRFIRRTL
${globbed}
ADDITIONAL_HEADER_DIRS
${CIRT_MAIN_INCLUDE_DIR}/cirt/Dialect/FIRRTL
${CIRCT_MAIN_INCLUDE_DIR}/circt/Dialect/FIRRTL
DEPENDS
MLIRFIRRTLIncGen

View File

@ -2,11 +2,11 @@
//
//===----------------------------------------------------------------------===//
#include "cirt/Dialect/FIRRTL/Dialect.h"
#include "cirt/Dialect/FIRRTL/Ops.h"
#include "circt/Dialect/FIRRTL/Dialect.h"
#include "circt/Dialect/FIRRTL/Ops.h"
#include "mlir/IR/DialectImplementation.h"
using namespace cirt;
using namespace circt;
using namespace firrtl;
//===----------------------------------------------------------------------===//
@ -97,7 +97,7 @@ FIRRTLDialect::FIRRTLDialect(MLIRContext *context)
// Register operations.
addOperations<
#define GET_OP_LIST
#include "cirt/Dialect/FIRRTL/FIRRTL.cpp.inc"
#include "circt/Dialect/FIRRTL/FIRRTL.cpp.inc"
>();
// Register interface implementations.
@ -129,4 +129,4 @@ Operation *FIRRTLDialect::materializeConstant(OpBuilder &builder,
}
// Provide implementations for the enums we use.
#include "cirt/Dialect/FIRRTL/FIRRTLEnums.cpp.inc"
#include "circt/Dialect/FIRRTL/FIRRTLEnums.cpp.inc"

View File

@ -2,18 +2,18 @@
//
//===----------------------------------------------------------------------===//
#include "cirt/Dialect/FIRRTL/Dialect.h"
#include "cirt/Dialect/FIRRTL/Passes.h"
#include "circt/Dialect/FIRRTL/Dialect.h"
#include "circt/Dialect/FIRRTL/Passes.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Pass/PassRegistry.h"
using namespace cirt;
using namespace circt;
using namespace firrtl;
// Static initialization for FIRRTL dialect registration.
static mlir::DialectRegistration<FIRRTLDialect> FIRRTLOps;
/// Register all of the FIRRTL transformation passes with the PassManager.
void cirt::firrtl::registerFIRRTLPasses() {
void circt::firrtl::registerFIRRTLPasses() {
#define GEN_PASS_REGISTRATION
#include "cirt/Dialect/FIRRTL/FIRRTLPasses.h.inc"
#include "circt/Dialect/FIRRTL/FIRRTLPasses.h.inc"
}

View File

@ -2,13 +2,13 @@
//
//===----------------------------------------------------------------------===//
#include "cirt/Dialect/FIRRTL/Ops.h"
#include "cirt/Dialect/FIRRTL/Passes.h"
#include "cirt/Dialect/RTL/Ops.h"
#include "circt/Dialect/FIRRTL/Ops.h"
#include "circt/Dialect/FIRRTL/Passes.h"
#include "circt/Dialect/RTL/Ops.h"
#include "mlir/IR/StandardTypes.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/DialectConversion.h"
using namespace cirt;
using namespace circt;
using namespace firrtl;
using namespace rtl;
@ -198,7 +198,7 @@ public:
} // end anonymous namespace
#define GEN_PASS_CLASSES
#include "cirt/Dialect/FIRRTL/FIRRTLPasses.h.inc"
#include "circt/Dialect/FIRRTL/FIRRTLPasses.h.inc"
namespace {
struct FIRRTLLowering : public LowerFIRRTLToRTLBase<FIRRTLLowering> {
@ -224,6 +224,6 @@ struct FIRRTLLowering : public LowerFIRRTLToRTLBase<FIRRTLLowering> {
};
} // end anonymous namespace
std::unique_ptr<mlir::Pass> cirt::firrtl::createLowerFIRRTLToRTLPass() {
std::unique_ptr<mlir::Pass> circt::firrtl::createLowerFIRRTLToRTLPass() {
return std::make_unique<FIRRTLLowering>();
}

View File

@ -2,12 +2,12 @@
//
//===----------------------------------------------------------------------===//
#include "cirt/Dialect/FIRRTL/Ops.h"
#include "circt/Dialect/FIRRTL/Ops.h"
#include "mlir/Dialect/CommonFolders.h"
#include "mlir/IR/Matchers.h"
#include "mlir/IR/PatternMatch.h"
using namespace cirt;
using namespace circt;
using namespace firrtl;
//===----------------------------------------------------------------------===//

View File

@ -2,13 +2,13 @@
//
//===----------------------------------------------------------------------===//
#include "cirt/Dialect/FIRRTL/Ops.h"
#include "cirt/Dialect/FIRRTL/Visitors.h"
#include "circt/Dialect/FIRRTL/Ops.h"
#include "circt/Dialect/FIRRTL/Visitors.h"
#include "mlir/IR/DialectImplementation.h"
#include "mlir/IR/FunctionImplementation.h"
#include "mlir/IR/StandardTypes.h"
using namespace cirt;
using namespace circt;
using namespace firrtl;
//===----------------------------------------------------------------------===//
@ -1060,4 +1060,4 @@ static LogicalResult verifyStdIntCast(StdIntCast cast) {
// Provide the autogenerated implementation guts for the Op classes.
#define GET_OP_CLASSES
#include "cirt/Dialect/FIRRTL/FIRRTL.cpp.inc"
#include "circt/Dialect/FIRRTL/FIRRTL.cpp.inc"

View File

@ -2,13 +2,13 @@
//
//===----------------------------------------------------------------------===//
#include "cirt/Dialect/FIRRTL/Types.h"
#include "cirt/Dialect/FIRRTL/Ops.h"
#include "circt/Dialect/FIRRTL/Types.h"
#include "circt/Dialect/FIRRTL/Ops.h"
#include "mlir/IR/DialectImplementation.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringSwitch.h"
using namespace cirt;
using namespace circt;
using namespace firrtl;
//===----------------------------------------------------------------------===//
@ -341,7 +341,7 @@ IntType IntType::get(MLIRContext *context, bool isSigned, int32_t width) {
// Width Qualified Ground Types
//===----------------------------------------------------------------------===//
namespace cirt {
namespace circt {
namespace firrtl {
namespace detail {
struct WidthTypeStorage : mlir::TypeStorage {
@ -359,7 +359,7 @@ struct WidthTypeStorage : mlir::TypeStorage {
};
} // namespace detail
} // namespace firrtl
} // namespace cirt
} // namespace circt
static Optional<int32_t>
getWidthQualifiedTypeWidth(firrtl::detail::WidthTypeStorage *impl) {
@ -402,7 +402,7 @@ Optional<int32_t> AnalogType::getWidth() {
// Flip Type
//===----------------------------------------------------------------------===//
namespace cirt {
namespace circt {
namespace firrtl {
namespace detail {
struct FlipTypeStorage : mlir::TypeStorage {
@ -421,7 +421,7 @@ struct FlipTypeStorage : mlir::TypeStorage {
} // namespace detail
} // namespace firrtl
} // namespace cirt
} // namespace circt
/// Return a bundle type with the specified elements all flipped. This assumes
/// the elements list is non-empty.
@ -487,7 +487,7 @@ FIRRTLType FlipType::getElementType() { return getImpl()->element; }
// Bundle Type
//===----------------------------------------------------------------------===//
namespace cirt {
namespace circt {
namespace firrtl {
namespace detail {
struct BundleTypeStorage : mlir::TypeStorage {
@ -520,7 +520,7 @@ struct BundleTypeStorage : mlir::TypeStorage {
} // namespace detail
} // namespace firrtl
} // namespace cirt
} // namespace circt
FIRRTLType BundleType::get(ArrayRef<BundleElement> elements,
MLIRContext *context) {
@ -583,7 +583,7 @@ FIRRTLType BundleType::getElementType(StringRef name) {
// Vector Type
//===----------------------------------------------------------------------===//
namespace cirt {
namespace circt {
namespace firrtl {
namespace detail {
struct VectorTypeStorage : mlir::TypeStorage {
@ -609,7 +609,7 @@ struct VectorTypeStorage : mlir::TypeStorage {
} // namespace detail
} // namespace firrtl
} // namespace cirt
} // namespace circt
FIRRTLType FVectorType::get(FIRRTLType elementType, unsigned numElements) {
// If elementType is a flip, then we canonicalize it outwards.

View File

@ -3,7 +3,7 @@ add_mlir_dialect_library(MLIRRTL
${globbed}
ADDITIONAL_HEADER_DIRS
${CIRT_MAIN_INCLUDE_DIR}/cirt/Dialect/RTL
${CIRCT_MAIN_INCLUDE_DIR}/circt/Dialect/RTL
DEPENDS
MLIRRTLIncGen

View File

@ -2,13 +2,13 @@
//
//===----------------------------------------------------------------------===//
#include "cirt/Dialect/RTL/Dialect.h"
#include "cirt/Dialect/RTL/Ops.h"
#include "circt/Dialect/RTL/Dialect.h"
#include "circt/Dialect/RTL/Ops.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/DialectImplementation.h"
#include "mlir/IR/StandardTypes.h"
using namespace cirt;
using namespace circt;
using namespace rtl;
//===----------------------------------------------------------------------===//
@ -21,7 +21,7 @@ RTLDialect::RTLDialect(MLIRContext *context)
// Register operations.
addOperations<
#define GET_OP_LIST
#include "cirt/Dialect/RTL/RTL.cpp.inc"
#include "circt/Dialect/RTL/RTL.cpp.inc"
>();
}

View File

@ -2,13 +2,13 @@
//
//===----------------------------------------------------------------------===//
#include "cirt/Dialect/RTL/Ops.h"
#include "cirt/Dialect/RTL/Visitors.h"
#include "circt/Dialect/RTL/Ops.h"
#include "circt/Dialect/RTL/Visitors.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/DialectImplementation.h"
#include "mlir/IR/StandardTypes.h"
using namespace cirt;
using namespace circt;
using namespace rtl;
/// Return true if the specified operation is a combinatorial logic op.
@ -93,4 +93,4 @@ static LogicalResult verifyExtOp(Operation *op) {
// Provide the autogenerated implementation guts for the Op classes.
#define GET_OP_CLASSES
#include "cirt/Dialect/RTL/RTL.cpp.inc"
#include "circt/Dialect/RTL/RTL.cpp.inc"

View File

@ -1,6 +1,6 @@
file(GLOB globbed *.cpp)
add_mlir_library(CIRTEmitVerilog
add_mlir_library(CIRCTEmitVerilog
${globbed}
ADDITIONAL_HEADER_DIRS

View File

@ -4,18 +4,18 @@
//
//===----------------------------------------------------------------------===//
#include "cirt/EmitVerilog.h"
#include "cirt/Dialect/FIRRTL/Visitors.h"
#include "cirt/Dialect/RTL/Ops.h"
#include "cirt/Dialect/RTL/Visitors.h"
#include "cirt/Support/LLVM.h"
#include "circt/EmitVerilog.h"
#include "circt/Dialect/FIRRTL/Visitors.h"
#include "circt/Dialect/RTL/Ops.h"
#include "circt/Dialect/RTL/Visitors.h"
#include "circt/Support/LLVM.h"
#include "mlir/IR/Module.h"
#include "mlir/IR/StandardTypes.h"
#include "mlir/Translation.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/Support/raw_ostream.h"
using namespace cirt;
using namespace circt;
using namespace firrtl;
using namespace mlir;
@ -997,7 +997,7 @@ SubExprInfo ExprEmitter::visitComb(rtl::SExtOp op) {
auto inWidth = inType.getWidth();
auto destWidth = op.getType().cast<IntegerType>().getWidth();
// Handle sign extend from a single bit in a pretty way.
// Handle sign extend from a single bit in a pretty way.
if (inWidth == 1) {
os << '{' << destWidth << '{';
emitSubExpr(op.getOperand(), LowestPrecedence);
@ -2218,12 +2218,12 @@ void CircuitEmitter::emitMLIRModule(ModuleOp module) {
}
}
LogicalResult cirt::emitVerilog(ModuleOp module, llvm::raw_ostream &os) {
LogicalResult circt::emitVerilog(ModuleOp module, llvm::raw_ostream &os) {
VerilogEmitterState state(os);
CircuitEmitter(state).emitMLIRModule(module);
return failure(state.encounteredError);
}
void cirt::registerVerilogEmitterTranslation() {
void circt::registerVerilogEmitterTranslation() {
static TranslateFromMLIRRegistration toVerilog("emit-verilog", emitVerilog);
}

View File

@ -1,6 +1,6 @@
file(GLOB globbed *.cpp)
add_mlir_library(CIRTFIRParser
add_mlir_library(CIRCTFIRParser
${globbed}
ADDITIONAL_HEADER_DIRS

View File

@ -10,7 +10,7 @@
#include "llvm/ADT/StringSwitch.h"
#include "llvm/Support/SourceMgr.h"
using namespace cirt;
using namespace circt;
using namespace firrtl;
using namespace mlir;
using llvm::SMLoc;

View File

@ -7,7 +7,7 @@
#ifndef FIRTOMLIR_FIRLEXER_H
#define FIRTOMLIR_FIRLEXER_H
#include "cirt/Support/LLVM.h"
#include "circt/Support/LLVM.h"
#include "llvm/Support/SourceMgr.h"
namespace mlir {
@ -15,7 +15,7 @@ class MLIRContext;
class Location;
} // namespace mlir
namespace cirt {
namespace circt {
namespace firrtl {
/// This represents a specific token for .fir files.
@ -123,6 +123,6 @@ private:
};
} // namespace firrtl
} // namespace cirt
} // namespace circt
#endif // FIRTOMLIR_FIRLEXER_H

View File

@ -4,9 +4,9 @@
//
//===----------------------------------------------------------------------===//
#include "cirt/FIRParser.h"
#include "circt/FIRParser.h"
#include "FIRLexer.h"
#include "cirt/Dialect/FIRRTL/Ops.h"
#include "circt/Dialect/FIRRTL/Ops.h"
#include "mlir/IR/Diagnostics.h"
#include "mlir/IR/Module.h"
#include "mlir/IR/StandardTypes.h"
@ -16,7 +16,7 @@
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/raw_ostream.h"
using namespace cirt;
using namespace circt;
using namespace firrtl;
using namespace mlir;
using llvm::SMLoc;
@ -2266,8 +2266,8 @@ ParseResult FIRCircuitParser::parseCircuit() {
//===----------------------------------------------------------------------===//
// Parse the specified .fir file into the specified MLIR context.
OwningModuleRef cirt::parseFIRFile(SourceMgr &sourceMgr, MLIRContext *context,
FIRParserOptions options) {
OwningModuleRef circt::parseFIRFile(SourceMgr &sourceMgr, MLIRContext *context,
FIRParserOptions options) {
auto sourceBuf = sourceMgr.getMemoryBuffer(sourceMgr.getMainFileID());
// This is the result module we are parsing into.
@ -2287,7 +2287,7 @@ OwningModuleRef cirt::parseFIRFile(SourceMgr &sourceMgr, MLIRContext *context,
return module;
}
void cirt::registerFIRParserTranslation() {
void circt::registerFIRParserTranslation() {
static TranslateToMLIRRegistration fromFIR(
"parse-fir", [](llvm::SourceMgr &sourceMgr, MLIRContext *context) {
return parseFIRFile(sourceMgr, context);

View File

@ -5,19 +5,19 @@ configure_lit_site_cfg(
${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py
)
set(CIRT_TEST_DEPENDS
set(CIRCT_TEST_DEPENDS
FileCheck count not
cirt-opt
cirt-translate
circt-opt
circt-translate
firtool
)
add_lit_testsuite(check-cirt "Running the CIRT regression tests"
add_lit_testsuite(check-circt "Running the CIRCT regression tests"
${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${CIRT_TEST_DEPENDS}
DEPENDS ${CIRCT_TEST_DEPENDS}
)
set_target_properties(check-cirt PROPERTIES FOLDER "Tests")
set_target_properties(check-circt PROPERTIES FOLDER "Tests")
add_lit_testsuites(CIRT ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ${CIRT_TEST_DEPS}
add_lit_testsuites(CIRCT ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ${CIRCT_TEST_DEPS}
)

View File

@ -1,4 +1,4 @@
; RUN: cirt-translate -parse-fir --mlir-print-debuginfo %s | cirt-translate -emit-verilog -verify-diagnostics | FileCheck %s --strict-whitespace
; RUN: circt-translate -parse-fir --mlir-print-debuginfo %s | circt-translate -emit-verilog -verify-diagnostics | FileCheck %s --strict-whitespace
circuit Xorr :
module inputs_only :

View File

@ -1,4 +1,4 @@
// RUN: cirt-translate -emit-verilog -verify-diagnostics --split-input-file -mlir-print-op-on-diagnostic=false %s
// RUN: circt-translate -emit-verilog -verify-diagnostics --split-input-file -mlir-print-op-on-diagnostic=false %s
func @foo() { // expected-error {{unknown operation}}
}

View File

@ -1,4 +1,4 @@
// RUN: cirt-translate %s -emit-verilog -verify-diagnostics | FileCheck %s --strict-whitespace
// RUN: circt-translate %s -emit-verilog -verify-diagnostics | FileCheck %s --strict-whitespace
firrtl.circuit "Circuit" {
firrtl.module @M1(%x : !firrtl.uint<8>,

View File

@ -1,4 +1,4 @@
// RUN: cirt-translate %s -emit-verilog -verify-diagnostics | FileCheck %s --strict-whitespace
// RUN: circt-translate %s -emit-verilog -verify-diagnostics | FileCheck %s --strict-whitespace
firrtl.circuit "Circuit" {
firrtl.module @M1(%x : !firrtl.uint<8> { firrtl.name = "y"},

View File

@ -1,4 +1,4 @@
; RUN: cirt-translate -parse-fir -verify-diagnostics %s | cirt-opt | FileCheck %s
; RUN: circt-translate -parse-fir -verify-diagnostics %s | circt-opt | FileCheck %s
circuit basic : ; CHECK: firrtl.circuit "basic" {

View File

@ -1,4 +1,4 @@
; RUN: cirt-translate -parse-fir -verify-diagnostics --split-input-file %s
; RUN: circt-translate -parse-fir -verify-diagnostics --split-input-file %s
circuit test :
extmodule MyModule :

View File

@ -1,4 +1,4 @@
; RUN: cirt-translate -parse-fir --mlir-print-debuginfo -verify-diagnostics %s | FileCheck %s
; RUN: circt-translate -parse-fir --mlir-print-debuginfo -verify-diagnostics %s | FileCheck %s
circuit basic : @[CIRCUIT.scala 127]

View File

@ -0,0 +1,3 @@
// RUN: circt-opt --help | FileCheck %s
//
// CHECK: OVERVIEW: circt modular optimizer driver

View File

@ -1,4 +1,4 @@
// RUN: cirt-opt %s -allow-unregistered-dialect | FileCheck %s
// RUN: circt-opt %s -allow-unregistered-dialect | FileCheck %s
// CHECK-LABEL: func @simpleCFG(%{{.*}}: i32, %{{.*}}: f32) -> i1 {
func @simpleCFG(%arg0: i32, %f: f32) -> i1 {

View File

@ -1,3 +0,0 @@
// RUN: cirt-opt --help | FileCheck %s
//
// CHECK: OVERVIEW: cirt modular optimizer driver

View File

@ -1,4 +1,4 @@
// RUN: cirt-opt -canonicalize %s | FileCheck %s
// RUN: circt-opt -canonicalize %s | FileCheck %s
// CHECK-LABEL: firrtl.module @And

View File

@ -1,4 +1,4 @@
// RUN: cirt-opt -cse %s | FileCheck %s
// RUN: circt-opt -cse %s | FileCheck %s
// CHECK-LABEL: firrtl.module @And
firrtl.module @And(%in1: !firrtl.uint<4>, %in2: !firrtl.uint<4>,

View File

@ -1,4 +1,4 @@
// RUN: cirt-opt %s -split-input-file -verify-diagnostics
// RUN: circt-opt %s -split-input-file -verify-diagnostics
firrtl.module @X(%b : !firrtl.unknowntype) {
// expected-error @-1 {{unknown firrtl type}}

View File

@ -1,4 +1,4 @@
// RUN: cirt-opt -pass-pipeline='firrtl.circuit(lower-firrtl-to-rtl)' %s | FileCheck %s
// RUN: circt-opt -pass-pipeline='firrtl.circuit(lower-firrtl-to-rtl)' %s | FileCheck %s
firrtl.circuit "Circuit" {

View File

@ -1,4 +1,4 @@
// RUN: cirt-opt %s | FileCheck %s
// RUN: circt-opt %s | FileCheck %s
//module MyModule :
// input in: UInt<8>

View File

@ -1,4 +1,4 @@
; RUN: firtool %s --format=fir -mlir | cirt-opt | FileCheck %s --check-prefix=MLIR
; RUN: firtool %s --format=fir -mlir | circt-opt | FileCheck %s --check-prefix=MLIR
; RUN: firtool %s --format=fir -verilog | FileCheck %s --check-prefix=VERILOG
circuit fir_test :

View File

@ -1,4 +1,4 @@
// RUN: firtool %s --format=mlir -mlir | cirt-opt | FileCheck %s --check-prefix=MLIR
// RUN: firtool %s --format=mlir -mlir | circt-opt | FileCheck %s --check-prefix=MLIR
// RUN: firtool %s --format=mlir -verilog | FileCheck %s --check-prefix=VERILOG
firrtl.circuit "Top" {

View File

@ -1,5 +1,5 @@
; RUN: firtool %s --format=fir | cirt-opt | FileCheck %s --check-prefix=OPT
; RUN: firtool %s --format=fir -disable-opt | cirt-opt | FileCheck %s --check-prefix=NOOPT
; RUN: firtool %s --format=fir | circt-opt | FileCheck %s --check-prefix=OPT
; RUN: firtool %s --format=fir -disable-opt | circt-opt | FileCheck %s --check-prefix=NOOPT
circuit optimizations :
module test_cse :

View File

@ -16,7 +16,7 @@ from lit.llvm.subst import FindTool
# Configuration file for the 'lit' test runner.
# name: The name of this test suite.
config.name = 'CIRT'
config.name = 'CIRCT'
config.test_format = lit.formats.ShTest(not llvm_config.use_lit_shell)
@ -27,7 +27,7 @@ config.suffixes = ['.td', '.mlir', '.ll', '.fir']
config.test_source_root = os.path.dirname(__file__)
# test_exec_root: The root path where tests should be run.
config.test_exec_root = os.path.join(config.cirt_obj_root, 'test')
config.test_exec_root = os.path.join(config.circt_obj_root, 'test')
config.substitutions.append(('%PATH%', config.environment['PATH']))
config.substitutions.append(('%shlibext', config.llvm_shlib_ext))
@ -46,15 +46,15 @@ config.excludes = ['Inputs', 'CMakeLists.txt', 'README.txt', 'LICENSE.txt']
config.test_source_root = os.path.dirname(__file__)
# test_exec_root: The root path where tests should be run.
config.test_exec_root = os.path.join(config.cirt_obj_root, 'test')
config.test_exec_root = os.path.join(config.circt_obj_root, 'test')
# Tweak the PATH to include the tools dir.
llvm_config.with_environment('PATH', config.llvm_tools_dir, append_path=True)
tool_dirs = [config.cirt_tools_dir, config.mlir_tools_dir, config.llvm_tools_dir]
tool_dirs = [config.circt_tools_dir, config.mlir_tools_dir, config.llvm_tools_dir]
tools = [
'cirt-opt',
'cirt-translate',
'circt-opt',
'circt-translate',
]
llvm_config.add_tool_substitutions(tools, tool_dirs)

View File

@ -31,9 +31,9 @@ config.host_arch = "@HOST_ARCH@"
config.mlir_src_root = "@MLIR_SOURCE_DIR@"
config.mlir_obj_root = "@MLIR_BINARY_DIR@"
config.mlir_tools_dir = "@MLIR_TOOLS_DIR@"
config.cirt_src_root = "@CIRT_SOURCE_DIR@"
config.cirt_obj_root = "@CIRT_BINARY_DIR@"
config.cirt_tools_dir = "@CIRT_TOOLS_DIR@"
config.circt_src_root = "@CIRCT_SOURCE_DIR@"
config.circt_obj_root = "@CIRCT_BINARY_DIR@"
config.circt_tools_dir = "@CIRCT_TOOLS_DIR@"
# Support substitution of the tools_dir with user parameters. This is
# used when we can't determine the tool dir at configuration time.
@ -49,4 +49,4 @@ import lit.llvm
lit.llvm.initialize(lit_config, config)
# Let the main config do the real work.
lit_config.load_config(config, "@CIRT_SOURCE_DIR@/test/lit.cfg.py")
lit_config.load_config(config, "@CIRCT_SOURCE_DIR@/test/lit.cfg.py")

View File

@ -1,4 +1,4 @@
// RUN: cirt-opt %s | FileCheck %s
// RUN: circt-opt %s | FileCheck %s
func @test1(%arg0: i3) -> i50 {
%a = rtl.constant(42 : i12) : i12

View File

@ -1,4 +1,4 @@
// RUN: cirt-opt %s -split-input-file -verify-diagnostics
// RUN: circt-opt %s -split-input-file -verify-diagnostics
func @test_constant() -> i32 {
// expected-error @+1 {{firrtl.constant attribute bitwidth doesn't match return type}}

View File

@ -1,4 +1,4 @@
add_subdirectory(cirt-opt)
add_subdirectory(cirt-translate)
add_subdirectory(circt-opt)
add_subdirectory(circt-translate)
add_subdirectory(firtool)

View File

@ -0,0 +1,20 @@
set(LIBS
MLIRFIRRTL
MLIRRTL
MLIRParser
MLIRSupport
MLIRIR
MLIROptLib
MLIRStandardOps
MLIRTransforms
LLVMSupport
)
add_llvm_tool(circt-opt
circt-opt.cpp
)
llvm_update_compile_flags(circt-opt)
target_link_libraries(circt-opt PRIVATE ${LIBS} ${targets_to_link})

View File

@ -1,12 +1,13 @@
//===- cirt-opt.cpp - The cirt-opt driver ---------------------------------===//
//===- circt-opt.cpp - The circt-opt driver
//---------------------------------===//
//
// This file implements the 'cirt-opt' tool, which is the cirt analog of
// This file implements the 'circt-opt' tool, which is the circt analog of
// mlir-opt, used to drive compiler passes, e.g. for testing.
//
//===----------------------------------------------------------------------===//
#include "cirt/Dialect/FIRRTL/Dialect.h"
#include "cirt/Dialect/RTL/Dialect.h"
#include "circt/Dialect/FIRRTL/Dialect.h"
#include "circt/Dialect/RTL/Dialect.h"
#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Pass/PassManager.h"
@ -20,7 +21,7 @@
using namespace llvm;
using namespace mlir;
using namespace cirt;
using namespace circt;
static cl::opt<std::string>
inputFilename(cl::Positional, cl::desc("<input file>"), cl::init("-"));
@ -79,7 +80,7 @@ int main(int argc, char **argv) {
PassPipelineCLParser passPipeline("", "Compiler passes to run");
// Parse pass names in main to ensure static initialization completed.
cl::ParseCommandLineOptions(argc, argv, "cirt modular optimizer driver\n");
cl::ParseCommandLineOptions(argc, argv, "circt modular optimizer driver\n");
MLIRContext context;
if (showDialects) {

View File

@ -0,0 +1,14 @@
set(LIBS
MLIRTranslation
MLIRIR
MLIRStandardOps
MLIRSupport
CIRCTEmitVerilog
CIRCTFIRParser
)
add_llvm_tool(circt-translate
circt-translate.cpp
)
llvm_update_compile_flags(circt-translate)
target_link_libraries(circt-translate PRIVATE ${LIBS} LLVMSupport)

View File

@ -1,14 +1,15 @@
//===- cirt-translate.cpp - CIRT Translation Driver -----------------------===//
//===- circt-translate.cpp - CIRCT Translation Driver
//-----------------------===//
//
// This is a command line utility that translates a file from/to MLIR using one
// of the registered translations.
//
//===----------------------------------------------------------------------===//
#include "cirt/Dialect/FIRRTL/Dialect.h"
#include "cirt/Dialect/RTL/Dialect.h"
#include "cirt/EmitVerilog.h"
#include "cirt/FIRParser.h"
#include "circt/Dialect/FIRRTL/Dialect.h"
#include "circt/Dialect/RTL/Dialect.h"
#include "circt/EmitVerilog.h"
#include "circt/FIRParser.h"
#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/IR/AsmState.h"
#include "mlir/IR/Diagnostics.h"
@ -21,7 +22,7 @@
#include "llvm/Support/ToolOutputFile.h"
using namespace mlir;
using namespace cirt;
using namespace circt;
static llvm::cl::opt<std::string> inputFilename(llvm::cl::Positional,
llvm::cl::desc("<input file>"),
@ -64,7 +65,7 @@ int main(int argc, char **argv) {
translationRequested("", llvm::cl::desc("Translation to perform"),
llvm::cl::Required);
llvm::cl::ParseCommandLineOptions(argc, argv, "CIRT translation driver\n");
llvm::cl::ParseCommandLineOptions(argc, argv, "CIRCT translation driver\n");
std::string errorMessage;
auto input = openInputFile(inputFilename, &errorMessage);

View File

@ -1,20 +0,0 @@
set(LIBS
MLIRFIRRTL
MLIRRTL
MLIRParser
MLIRSupport
MLIRIR
MLIROptLib
MLIRStandardOps
MLIRTransforms
LLVMSupport
)
add_llvm_tool(cirt-opt
cirt-opt.cpp
)
llvm_update_compile_flags(cirt-opt)
target_link_libraries(cirt-opt PRIVATE ${LIBS} ${targets_to_link})

View File

@ -1,14 +0,0 @@
set(LIBS
MLIRTranslation
MLIRIR
MLIRStandardOps
MLIRSupport
CIRTEmitVerilog
CIRTFIRParser
)
add_llvm_tool(cirt-translate
cirt-translate.cpp
)
llvm_update_compile_flags(cirt-translate)
target_link_libraries(cirt-translate PRIVATE ${LIBS} LLVMSupport)

View File

@ -1,6 +1,6 @@
set(LIBS
CIRTEmitVerilog
CIRTFIRParser
CIRCTEmitVerilog
CIRCTFIRParser
MLIRParser
MLIRSupport

View File

@ -5,10 +5,10 @@
//
//===----------------------------------------------------------------------===//
#include "cirt/Dialect/FIRRTL/Dialect.h"
#include "cirt/Dialect/RTL/Dialect.h"
#include "cirt/EmitVerilog.h"
#include "cirt/FIRParser.h"
#include "circt/Dialect/FIRRTL/Dialect.h"
#include "circt/Dialect/RTL/Dialect.h"
#include "circt/EmitVerilog.h"
#include "circt/FIRParser.h"
#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/IR/Module.h"
#include "mlir/Parser.h"
@ -22,7 +22,7 @@
using namespace llvm;
using namespace mlir;
using namespace cirt;
using namespace circt;
/// Allow the user to specify the input file format. This can be used to
/// override the input, and can be used to specify ambiguous cases like standard
@ -126,7 +126,7 @@ int main(int argc, char **argv) {
registerDialect<rtl::RTLDialect>();
// Parse pass names in main to ensure static initialization completed.
cl::ParseCommandLineOptions(argc, argv, "cirt modular optimizer driver\n");
cl::ParseCommandLineOptions(argc, argv, "circt modular optimizer driver\n");
// Figure out the input format if unspecified.
if (inputFormat == InputUnspecified) {