46
46
#include " xls/codegen/codegen_pass.h"
47
47
#include " xls/codegen/codegen_wrapper_pass.h"
48
48
#include " xls/codegen/concurrent_stage_groups.h"
49
+ #include " xls/codegen/mark_channel_fifos_pass.h"
49
50
#include " xls/codegen/register_legalization_pass.h"
50
51
#include " xls/codegen/vast/vast.h"
51
52
#include " xls/common/casts.h"
@@ -1474,13 +1475,12 @@ static absl::Status AddInputOutputFlops(
1474
1475
for (auto & vec : streaming_io.inputs ) {
1475
1476
for (StreamingInput& input : vec) {
1476
1477
StreamingChannel* channel = down_cast<StreamingChannel*>(input.channel );
1478
+ XLS_RET_CHECK (channel->channel_config ().input_flop_kind ())
1479
+ << " No input flop kind" ;
1477
1480
// TODO(https://github.com/google/xls/issues/1803): This is super hacky.
1478
1481
// We really should have a different pass that configures all the channels
1479
1482
// in a separate lowering step.
1480
- FlopKind kind = channel->channel_config ().input_flop_kind ().value_or (
1481
- options.flop_inputs ()
1482
- ? CodegenOptions::IOKindToFlopKind (options.flop_inputs_kind ())
1483
- : FlopKind::kNone );
1483
+ FlopKind kind = *channel->channel_config ().input_flop_kind ();
1484
1484
XLS_RETURN_IF_ERROR (AddRegisterAfterStreamingInput (
1485
1485
input, kind, options.ResetBehavior (), block, valid_nodes));
1486
1486
@@ -1496,13 +1496,12 @@ static absl::Status AddInputOutputFlops(
1496
1496
for (auto & vec : streaming_io.outputs ) {
1497
1497
for (StreamingOutput& output : vec) {
1498
1498
StreamingChannel* channel = down_cast<StreamingChannel*>(output.channel );
1499
+ XLS_RET_CHECK (channel->channel_config ().output_flop_kind ())
1500
+ << " No output flop kind" ;
1499
1501
// TODO(https://github.com/google/xls/issues/1803): This is super hacky.
1500
1502
// We really should have a different pass that configures all the channels
1501
1503
// in a separate lowering step.
1502
- FlopKind kind = channel->channel_config ().output_flop_kind ().value_or (
1503
- options.flop_outputs ()
1504
- ? CodegenOptions::IOKindToFlopKind (options.flop_outputs_kind ())
1505
- : FlopKind::kNone );
1504
+ FlopKind kind = *channel->channel_config ().output_flop_kind ();
1506
1505
XLS_RETURN_IF_ERROR (AddRegisterBeforeStreamingOutput (
1507
1506
output, kind, options.ResetBehavior (), block, valid_nodes));
1508
1507
@@ -3401,6 +3400,15 @@ absl::StatusOr<CodegenPassUnit> PackageToPipelinedBlocks(
3401
3400
module_name);
3402
3401
CodegenPassUnit unit (package, top_block);
3403
3402
3403
+ // Run codegen passes as appropriate
3404
+ {
3405
+ MarkChannelFifosPass mark_chans;
3406
+ CodegenPassOptions cg_options;
3407
+ cg_options.codegen_options = options;
3408
+ CodegenPassResults results;
3409
+ XLS_RETURN_IF_ERROR (mark_chans.Run (&unit, cg_options, &results).status ());
3410
+ }
3411
+
3404
3412
for (const auto & [fb, schedule] : sorted_schedules) {
3405
3413
std::string sub_block_name = block_name_uniquer.GetSanitizedUniqueName (
3406
3414
SanitizeIdentifier (fb->name ()));
0 commit comments