1

Is it possible to define a UDP with more than one output? I even try to make bundle output as follow, but it makes some errors. I'm trying to write the code for an 8-bit prefix adder, and I want to define the operation as a UDP to calculate the value for G and P. This is the code:

primitive preaddprimitive(pgout,p2,p1,g2,g1);
input p2,p1,g2,g1;
output pgout;
table
// p2 p1 g2 g1 : {pout,gout}
  0 ? 0 ? : 00;
  ? 0 1 ? : 01;
  0 ? 1 ? : 01;
  1 0 0 0 : 00;
  1 0 0 1 : 01;
  1 1 0 0 : 10;
  1 1 0 1 : 11;
  1 1 1 ? : 11;
endtable
endprimitive

and this is the error message:

near "0": syntax error, unexpected '0', expecting ';'

I tried to define to output, but it made the same error. I tested the code on modelsim 10.c.

toolic
  • 57,801
  • 17
  • 75
  • 117

1 Answers1

2

No, it is not possible to define a UDP with more than one output. According to the IEEE Std 1800-2012, section 29.2 Overview:

Each UDP has exactly one output, which can be in one of three states: 0, 1, or x.

and section 29.3.1 UDP header

All ports of a UDP shall be scalar; vector ports are not permitted.

You can use a module instead of a primitive.

toolic
  • 57,801
  • 17
  • 75
  • 117