@@ -732,7 +732,7 @@ TEST_F(BlockConversionTest, ProcWithVariousNextStateNodes) {
732732 IsOkAndHolds (ElementsAre (10 , 20 , 30 )));
733733}
734734
735- TEST_F (BlockConversionTest, DISABLED_ProcWithNextStateNodeBeforeParam ) {
735+ TEST_F (BlockConversionTest, ProcWithNextStateNodeBeforeParam ) {
736736 // A block with the next-state node scheduled before the param.
737737 auto p = CreatePackage ();
738738 Type* u32 = p->GetBitsType (32 );
@@ -1077,10 +1077,12 @@ proc my_proc(st: (), init={()}) {
10771077 EXPECT_THAT (FindNode (" in_vld" , block), m::InputPort (" in_vld" ));
10781078 EXPECT_THAT (
10791079 FindNode (" in_rdy" , block),
1080- m::OutputPort (" in_rdy" ,
1081- m::And (m::And (m::Literal (1 ), m::Or (m::InputPort (" in_vld" ),
1082- m::Not (m::Literal (1 )))),
1083- m::Literal (1 ), m::Literal (1 ))));
1080+ m::OutputPort (
1081+ " in_rdy" ,
1082+ m::And (m::And (m::Literal (1 ),
1083+ m::And (m::Literal (1 ), m::Or (m::InputPort (" in_vld" ),
1084+ m::Not (m::Literal (1 ))))),
1085+ m::Literal (1 ), m::Literal (1 ))));
10841086}
10851087
10861088TEST_F (BlockConversionTest, OnlyFIFOInProcGateRecvsFalse) {
@@ -1113,10 +1115,12 @@ proc my_proc(st: (), init={()}) {
11131115 EXPECT_THAT (FindNode (" in_vld" , block), m::InputPort (" in_vld" ));
11141116 EXPECT_THAT (
11151117 FindNode (" in_rdy" , block),
1116- m::OutputPort (" in_rdy" ,
1117- m::And (m::And (m::Literal (1 ), m::Or (m::InputPort (" in_vld" ),
1118- m::Not (m::Literal (1 )))),
1119- m::Literal (1 ), m::Literal (1 ))));
1118+ m::OutputPort (
1119+ " in_rdy" ,
1120+ m::And (m::And (m::Literal (1 ),
1121+ m::And (m::Literal (1 ), m::Or (m::InputPort (" in_vld" ),
1122+ m::Not (m::Literal (1 ))))),
1123+ m::Literal (1 ), m::Literal (1 ))));
11201124}
11211125
11221126TEST_F (BlockConversionTest, UnconditionalSendRdyVldProc) {
@@ -1569,7 +1573,7 @@ TEST_F(BlockConversionTest, OneToTwoProc) {
15691573 block,
15701574 {{" dir" , 1 }, {" in" , 123 }, {" in_vld" , 0 }, {" a_rdy" , 1 }, {" b_rdy" , 1 }}),
15711575 IsOkAndHolds (UnorderedElementsAre (Pair (" a" , 123 ), Pair (" b_vld" , 0 ),
1572- Pair (" in_rdy" , 1 ), Pair (" a_vld" , 0 ),
1576+ Pair (" in_rdy" , 0 ), Pair (" a_vld" , 0 ),
15731577 Pair (" b" , 123 ))));
15741578
15751579 // Output A selected. Input valid and output ready *not* asserted.
@@ -2541,7 +2545,7 @@ class MultiInputPipelinedProcTestSweepFixture
25412545 }
25422546};
25432547
2544- TEST_P (MultiInputPipelinedProcTestSweepFixture, DISABLED_RandomStalling ) {
2548+ TEST_P (MultiInputPipelinedProcTestSweepFixture, RandomStalling ) {
25452549 int64_t stage_count = std::get<0 >(GetParam ());
25462550 bool flop_inputs = std::get<1 >(GetParam ());
25472551 bool flop_outputs = std::get<2 >(GetParam ());
@@ -3290,8 +3294,7 @@ class MultiInputWithStatePipelinedProcTestSweepFixture
32903294 }
32913295};
32923296
3293- TEST_P (MultiInputWithStatePipelinedProcTestSweepFixture,
3294- DISABLED_RandomStalling) {
3297+ TEST_P (MultiInputWithStatePipelinedProcTestSweepFixture, RandomStalling) {
32953298 int64_t stage_count = std::get<0 >(GetParam ());
32963299 bool flop_inputs = std::get<1 >(GetParam ());
32973300 bool flop_outputs = std::get<2 >(GetParam ());
@@ -3893,7 +3896,72 @@ proc pipelined_proc(tkn: token, st: bits[32], init={token, 1}) {
38933896 IsOkAndHolds (testing::ElementsAreArray (expected_output)));
38943897}
38953898
3896- TEST_F (ProcConversionTestFixture, DISABLED_ProcIIGreaterThanOne) {
3899+ TEST_F (ProcConversionTestFixture, SimpleProcIIGreaterThanOne) {
3900+ const std::string ir_text = R"( package test
3901+ chan in(bits[32], id=0, kind=streaming, ops=receive_only, flow_control=ready_valid)
3902+ chan out(bits[32], id=1, kind=streaming, ops=send_only, flow_control=ready_valid)
3903+
3904+ #[initiation_interval(2)]
3905+ proc pipelined_proc(tkn: token, st: bits[32], init={token, 0}) {
3906+ send.1: token = send(tkn, st, channel=out, id=1)
3907+ min_delay.2: token = min_delay(send.1, delay=1, id=2)
3908+ receive.3: (token, bits[32]) = receive(min_delay.2, channel=in, id=3)
3909+ tuple_index.4: token = tuple_index(receive.3, index=0, id=4)
3910+ tuple_index.5: bits[32] = tuple_index(receive.3, index=1, id=5)
3911+ next_st: () = next_value(param=st, value=tuple_index.5)
3912+ next_tkn: () = next_value(param=tkn, value=tuple_index.4)
3913+ }
3914+ )" ;
3915+
3916+ XLS_ASSERT_OK_AND_ASSIGN (std::unique_ptr<Package> package,
3917+ Parser::ParsePackage (ir_text));
3918+
3919+ XLS_ASSERT_OK_AND_ASSIGN (Proc * proc, package->GetProc (" pipelined_proc" ));
3920+
3921+ CodegenOptions options;
3922+ options.flop_inputs (false ).flop_outputs (false ).clock_name (" clk" );
3923+ options.valid_control (" input_valid" , " output_valid" );
3924+ options.reset (" rst" , false , false , true );
3925+ options.streaming_channel_data_suffix (" _data" );
3926+ options.streaming_channel_valid_suffix (" _valid" );
3927+ options.streaming_channel_ready_suffix (" _ready" );
3928+ options.module_name (" pipelined_proc" );
3929+
3930+ XLS_ASSERT_OK_AND_ASSIGN (
3931+ Block * block,
3932+ ConvertToBlock (proc, options, SchedulingOptions ().pipeline_stages (3 )));
3933+
3934+ std::vector<ChannelSource> sources{
3935+ ChannelSource (" in_data" , " in_valid" , " in_ready" , 1.0 , block),
3936+ };
3937+ XLS_ASSERT_OK (sources.front ().SetDataSequence ({10 , 20 , 30 }));
3938+ std::vector<ChannelSink> sinks{
3939+ ChannelSink (
3940+ " out_data" , " out_valid" , " out_ready" , 1.0 , block,
3941+ /* reset_behavior=*/ ChannelSink::BehaviorDuringReset::kIgnoreValid ),
3942+ };
3943+
3944+ std::string reset_name = options.reset ()->name ();
3945+ uint64_t reset_active = options.reset ()->active_low () ? 0 : 1 ;
3946+ uint64_t reset_inactive = options.reset ()->active_low () ? 1 : 0 ;
3947+ std::vector<absl::flat_hash_map<std::string, uint64_t >> inputs (
3948+ 20 , {{reset_name, reset_inactive}});
3949+ XLS_ASSERT_OK (
3950+ SetSignalsOverCycles (0 , 9 , {{reset_name, reset_active}}, inputs));
3951+ XLS_ASSERT_OK_AND_ASSIGN (BlockIOResultsAsUint64 results,
3952+ InterpretChannelizedSequentialBlockWithUint64 (
3953+ block, absl::MakeSpan (sources),
3954+ absl::MakeSpan (sinks), inputs, options.reset ()));
3955+ EXPECT_THAT (
3956+ sinks.at (0 ).GetOutputCycleSequenceAsUint64 (),
3957+ IsOkAndHolds (Skipping (
3958+ 10 , ElementsAre (0 , std::nullopt , 10 , std::nullopt , 20 , std::nullopt ,
3959+ 30 , std::nullopt , std::nullopt , std::nullopt ))));
3960+ EXPECT_THAT (sinks.at (0 ).GetOutputSequenceAsUint64 (),
3961+ IsOkAndHolds (ElementsAre (0 , 10 , 20 , 30 )));
3962+ }
3963+
3964+ TEST_F (ProcConversionTestFixture, ProcIIGreaterThanOne) {
38973965 const std::string ir_text = R"( package test
38983966chan in(bits[32], id=0, kind=streaming, ops=receive_only, flow_control=ready_valid)
38993967chan out(bits[32], id=1, kind=streaming, ops=send_only, flow_control=ready_valid)
@@ -3959,18 +4027,11 @@ proc pipelined_proc(tkn: token, st: bits[32], init={token, 0}) {
39594027 IsOkAndHolds (Skipping (
39604028 10 , ElementsAre (0 , std::nullopt , 10 , std::nullopt , 20 , std::nullopt ,
39614029 30 , std::nullopt , std::nullopt , std::nullopt ))));
3962- EXPECT_THAT (sinks.at (1 ).GetOutputCycleSequenceAsUint64 (),
3963- IsOkAndHolds (Skipping (
3964- 10 , ElementsAre (std::nullopt , 10 , std::nullopt , 20 ,
3965- std::nullopt , 30 , std::nullopt , std::nullopt ,
3966- std::nullopt , std::nullopt ))));
39674030 EXPECT_THAT (sinks.at (0 ).GetOutputSequenceAsUint64 (),
39684031 IsOkAndHolds (ElementsAre (0 , 10 , 20 , 30 )));
3969- EXPECT_THAT (sinks.at (1 ).GetOutputSequenceAsUint64 (),
3970- IsOkAndHolds (ElementsAre (10 , 20 , 30 )));
39714032}
39724033
3973- TEST_F (ProcConversionTestFixture, DISABLED_ProcIIGreaterThanOneRandomStalls ) {
4034+ TEST_F (ProcConversionTestFixture, ProcIIGreaterThanOneRandomStalls ) {
39744035 const std::string ir_text = R"( package test
39754036chan in(bits[32], id=0, kind=streaming, ops=receive_only, flow_control=ready_valid)
39764037chan out(bits[32], id=1, kind=streaming, ops=send_only, flow_control=ready_valid)
0 commit comments