2
\$\begingroup\$

I have tried simulating a multiplier which has a datapath and a control path as shown in the video. PFA the link

https://www.youtube.com/watch?v=OWUFb2DZpQE&list=PLUtfVcb-iqn-EkuBs3arreilxa2UKIChl&index=26

The multiplier is based on first designing the datapath according to the flowchart:

flowchart

followed by implementing the controller using an FSM which is connected to the datapath

enter image description here

enter image description here

Can someone explain where I'm making a mistake in the code?

My code is on EDA Playground here.

\$\endgroup\$
0

2 Answers 2

3
\$\begingroup\$

When I run the simulation on EDA Playground, the Aldec simulator you selected generates several warning messages:

# SLP: Warning: testbench.sv (9): Length of connection (16) does not match the length of port "decB" (1) on instance "/mul_test/DP".
# SLP: Warning: testbench.sv (9): Length of connection (1) does not match the length of port "data_in" (16) on instance "/mul_test/DP".
# SLP: Warning: design.sv (7): Length of connection (1) does not match the length of port "dout" (16) on instance "/mul_test/DP/A".

etc.

Sometimes the messages scroll by very quickly, and it is not easy to see them. However, you should always carefully inspect all the messages, especially when the simulation does not behave as you expect it to.

Also, some simulators generate messages which are more helpful than others. If you don't understand these messages, there are several other simulators on EDA Playground to choose from. For example, you can also try the Cadence simulator.

Since you specifically asked about the y signal, I switched to the Cadence simulator, and I got this message related to the mul_datapath module, which has the y signal:

  mul_datapath DP(eqz,LdA,LdB,LdP,decB,data_in,clk);
                |
xmelab: *W,CUVWSI : 1 input port was not connected:
xmelab: clk

Although this says clk is not connected, and you clearly add clk to the connection list, the problem is that you have too few signals in the list. This is a common error when using connection-by-order. A better method is to use connection-by-name. Although it is more verbose, it makes it easier to debug this common problem. For example, change:

mul_datapath DP(eqz,LdA,LdB,LdP,decB,data_in,clk);

to:

mul_datapath dut (
        // Inputs:
    .LdA      (LdA),
    .LdB      (LdB),
    .LdP      (LdP),
    .clk      (clk),
    .clrP     (clrP),
    .data_in  (data_in),
    .decB     (decB),
        // Outputs:
    .eqz      (eqz)
);

This partially fixes the unknown y at time 35ns. You should fix all other warning messages.

\$\endgroup\$
-1
\$\begingroup\$

I made a design mistake in my code where I should have just taken one variable either the bus or the data_in; besides that the datapath also had a output component, y which was not included in datapath module in my design.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.