Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
17043 Discussions

Problem Assigning multibit output in SystemVerilog

Altera_Forum
Honored Contributor II
1,708 Views

Hello everyone! 

 

I'm trying to set an multibit output with a state machine design in SystemVerilog. When I am running the testbench, I can see the inputs transitioning as expected but my output doesn't appear to be moving (I'm including a screenshot of what I'm seeing).  

 

Basically, when state is S0, La should be 2'b10 and when state is S1, La should be 2'b01. Unfortunately, I don't know how to set more than a single bit using the assign command so I'm assigning each bit individually (which could be causing my issue). It's possible I should be using another command (or should be including it in a case statement) but I'm not sure where to go from here. Below is an excerpt of the code I am using: 

 

module RandomModule(output logic Lb); typedef enum logic {S0, S1, S2, S3} statetype; statetype state; //More Code Here //output logic assign Lb=(state==S0); assign Lb=(state==S1); //More Code Here endmodule  

 

I would expect S0 to set Lb[1:0] to 0'b10 and S1 to set Lb[1:0] to 0'b01 but apparently, this is not the case. Can anyone help me with this? Thanks a lot!
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
1,048 Views

Your screenshot does not match the code you are showing. Where is the state variable in the waveform? 

 

You can use a concatenation do do this in one statement. 

 

assign Lb = {state==S0,state==S1);
0 Kudos
Reply