Skip to content

Commit

Permalink
Clean up codegen options.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 612961319
  • Loading branch information
grebe authored and copybara-github committed Mar 5, 2024
1 parent 14fbb92 commit fd08d76
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions xls/codegen/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,7 @@ cc_library(
"//xls/ir:op",
"//xls/ir:register",
"@com_google_absl//absl/container:flat_hash_map",
"@com_google_absl//absl/types:span",
],
)

Expand Down
10 changes: 6 additions & 4 deletions xls/codegen/codegen_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@
#ifndef XLS_CODEGEN_CODEGEN_OPTIONS_H_
#define XLS_CODEGEN_CODEGEN_OPTIONS_H_

#include <cstdint>
#include <memory>
#include <optional>
#include <string>
#include <string_view>
#include <vector>

#include "absl/container/flat_hash_map.h"
#include "absl/types/span.h"
#include "xls/codegen/module_signature.pb.h"
#include "xls/codegen/op_override.h"
#include "xls/codegen/ram_configuration.h"
Expand All @@ -42,7 +44,7 @@ class CodegenOptions {
~CodegenOptions() = default;

// Enum to describe how IO should be registered.
enum class IOKind { kFlop = 0, kSkidBuffer, kZeroLatencyBuffer };
enum class IOKind : uint8_t { kFlop = 0, kSkidBuffer, kZeroLatencyBuffer };

// Convert IOKind enum to a string.
static std::string_view IOKindToString(IOKind kind);
Expand Down Expand Up @@ -71,7 +73,7 @@ class CodegenOptions {
// Name to use for the generated module. If not given, the name of the XLS
// function/proc is used.
CodegenOptions& module_name(std::string_view name);
const std::optional<std::string_view> module_name() const {
std::optional<std::string_view> module_name() const {
return module_name_;
}

Expand Down Expand Up @@ -113,12 +115,12 @@ class CodegenOptions {
bool separate_lines() const { return separate_lines_; }

// Whether to flop inputs into a register at the beginning of the pipeline. If
// true, adds a single cycle to the latency of the pipline.
// true, adds a single cycle to the latency of the pipeline.
CodegenOptions& flop_inputs(bool value);
bool flop_inputs() const { return flop_inputs_; }

// Whether to flop outputs into a register at the end of the pipeline. If
// true, adds a single cycle to the latency of the pipline.
// true, adds a single cycle to the latency of the pipeline.
CodegenOptions& flop_outputs(bool value);
bool flop_outputs() const { return flop_outputs_; }

Expand Down

0 comments on commit fd08d76

Please sign in to comment.