T
thomasc
Guest
My understanding is that it is possible to have a function that's made of
only one function and that the function can be used in another module by
"`include" the .v file from the module. That's what I did in my codes
below, but ModelSim gave an error message saying:
# ** Error: D:/My_Projects/temp/word_aligner.v(2): Cannot open `include
file "D:My_Projects empaligned_word.v".
# -- Compiling module word_aligner
# ** Error: D:/My_Projects/temp/word_aligner.v(11): Undefined variable:
aligned_word.
Below is my codes. I changed the forward slash('/') in the path of
`include statement. But it didn't work ou, too. Please let me know what
the problem is.
`timescale 1ns/1ns
`include "D:/My_Projects/temp/aligned_word.v" // line (2)
//MODULE word_aligner
module word_aligner;
output [3: 0] word_out;
integer i;
initial begin
for (i=0;i<4;i=i+1)
word_out=aligned_word; // line (11)
end
endmodule
//MODULE aligned_word
function aligned_word;
input index;
reg [7:0] temp=8'b01011010;
aligned_word = temp[index];
endfunction
only one function and that the function can be used in another module by
"`include" the .v file from the module. That's what I did in my codes
below, but ModelSim gave an error message saying:
# ** Error: D:/My_Projects/temp/word_aligner.v(2): Cannot open `include
file "D:My_Projects empaligned_word.v".
# -- Compiling module word_aligner
# ** Error: D:/My_Projects/temp/word_aligner.v(11): Undefined variable:
aligned_word.
Below is my codes. I changed the forward slash('/') in the path of
`include statement. But it didn't work ou, too. Please let me know what
the problem is.
`timescale 1ns/1ns
`include "D:/My_Projects/temp/aligned_word.v" // line (2)
//MODULE word_aligner
module word_aligner;
output [3: 0] word_out;
integer i;
initial begin
for (i=0;i<4;i=i+1)
word_out=aligned_word; // line (11)
end
endmodule
//MODULE aligned_word
function aligned_word;
input index;
reg [7:0] temp=8'b01011010;
aligned_word = temp[index];
endfunction