EmbDev.net

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


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


Rate this post
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)
1
module myModule
2
# (parameter UNSIGNED = 1)
3
    generate
4
        if (UNSIGNED == 1)
5
            input logic [7:0] my_bus;
6
        else
7
            input logic signed [7:0] my_bus;
8
    endgenerate)
9
10
// data structure guts here
11
12
13
endmodule

Is something like this possible?

Thanks for taking a look!

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.