Forum: FPGA, VHDL & Verilog Parameterizing a data type in SystemVerilog/Verilog

von Joshua V. (Company: Harvey Mudd College) (poofjunior)

Rate this post
0 useful
not useful
Hi all,

I have a data structure that I'm building, and I'm wondering if it's 
possible to parameterize the datatype to be unsigned or signed.

Here's an example of what I'd imagine (although it's not valid syntax)
module myModule
# (parameter UNSIGNED = 1)
        if (UNSIGNED == 1)
            input logic [7:0] my_bus;
            input logic signed [7:0] my_bus;

// data structure guts here


Is something like this possible?

Thanks for taking a look!


Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [vhdl]VHDL code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]

Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.