- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello all,
I'm getting the following errors during Analysis and Synthesis and I can't find much about them using Google.
Error (10733): Verilog HDL error at spi_shapes_to_video.sv(67): color is not declared under this prefix
Error (10733): Verilog HDL error at spi_shapes_to_video.sv(86): y is not declared under this prefix
If it's relevant, the file that is being referred to is part of a generated component under Platform Designer.
Here is the source file spi_shapes_to_video.sv
module spi_shapes_to_video (
input wire spi_clk_clk, // spi_clk.clk
input wire video_clk_clk, // video_clk.clk
input wire spi_rst_reset, // spi_rst.reset
input wire video_rst_reset, // video_rst.reset
input wire [7:0] spi_sink_data, // spi_sink.data
input wire spi_sink_valid, // .valid
input wire video_source_ready, // .ready
output logic spi_sink_ready, // .ready
output logic [15:0] video_source_data, // video_source.data
output logic video_source_startofpacket, // .startofpacket
output logic video_source_endofpacket, // .endofpacket
output logic video_source_valid // .valid
);
localparam NUM_LINES_WIDTH = 10;
localparam NUM_LINES = 1 << NUM_LINES_WIDTH;
localparam SCREEN_WIDTH = 640;
localparam SCREEN_HEIGHT = 480;
localparam COLOR_BG = 16'b0;
typedef enum {
STATE_PRE_INPUT,
STATE_INPUT,
STATE_PRE_OUTPUT,
STATE_OUTPUT
} state_t;
typedef struct packed {
logic [3:0] alpha;
logic [3:0] r;
logic [3:0] g;
logic [3:0] b;
} color_t;
typedef struct packed {
logic [9:0] x;
logic [8:0] y;
} point_t;
typedef struct packed {
logic [1:0] align_bits;
point_t start_point;
point_t end_point;
color_t color;
} line_t;
function line_has_point (
input point_t point,
input line_t line
);
line_has_point = (point.y - line.start_point.y) * (line.end_point.x - line.start_point.x)
== (point.x - line.start_point.x) * (line.end_point.y - line.start_point.y);
endfunction
function color_t get_color(
input point_t point
);
integer i;
color_t out;
begin
out = COLOR_BG;
for (i = 0; i < NUM_LINES; i++) begin
if (line_has_point(point, lines[i])) out = lines[i].color;
end
get_color = out;
end
endfunction
function state_t get_next_state(
input state_t state
);
case(state)
STATE_PRE_INPUT:
get_next_state = STATE_INPUT;
STATE_INPUT:
if (lines_index == NUM_LINES)
get_next_state = STATE_PRE_OUTPUT;
else get_next_state = STATE_INPUT;
STATE_PRE_OUTPUT:
get_next_state = STATE_OUTPUT;
STATE_OUTPUT:
if (current_point.y == SCREEN_HEIGHT)
get_next_state = STATE_PRE_INPUT;
else get_next_state = STATE_OUTPUT;
default: get_next_state = STATE_PRE_INPUT;
endcase
endfunction
state_t state;
logic [1:0] video_clk_vals;
line_t [NUM_LINES-1:0] lines /* synthesis ramstyle = "M9K" */;
logic [NUM_LINES_WIDTH:0] lines_index;
logic [2:0] line_byte_count;
point_t current_point;
always @(posedge spi_clk_clk) begin
if (~spi_rst_reset) begin
lines = 0;
lines_index = 0;
line_byte_count = 0;
video_clk_vals = 2'b0;
state = STATE_PRE_INPUT;
current_point = 0;
spi_sink_ready = 1'b0;
video_source_valid = 1'b0;
video_source_data = 16'b0;
video_source_startofpacket = 1'b0;
video_source_endofpacket = 1'b0;
end else begin
video_clk_vals = {video_clk_vals[0], video_clk_clk};
state = get_next_state(state);
case(state)
STATE_PRE_INPUT: begin
lines_index = 0;
end
STATE_INPUT: begin
spi_sink_ready = 1'b1;
video_source_valid = 1'b0;
if (spi_sink_valid) begin
lines[lines_index] = {lines[lines_index][47:0], spi_sink_data};
line_byte_count += 1;
end
if (line_byte_count == 7) begin
lines_index += 1;
line_byte_count = 0;
end
end
STATE_PRE_OUTPUT: begin
spi_sink_ready = 1'b0;
current_point = 0;
end
STATE_OUTPUT: begin
// negedge of video clock
if (video_clk_vals == 2'b10) begin
if (video_source_ready) begin
video_source_valid = 1;
video_source_data = get_color(current_point);
video_source_startofpacket = current_point == 0;
video_source_endofpacket = current_point.x == SCREEN_WIDTH - 1 &&
current_point.y == SCREEN_HEIGHT - 1;
current_point.x += 1;
if (current_point.x == SCREEN_WIDTH) begin
current_point.x = 0;
current_point.y += 1;
end
end else begin
video_source_valid = 0;
end
end
end
endcase
end
end
endmodule
Thanks for any help with this... I have no idea what the issue is.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The error code meant to fix the problem identified by the message text.
Could you share your project so I can further check on this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello, thanks for your response. I've attached the project to this message. I am using Quartus Prime Lite version 18.1.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Okay I fixed the issue by not referencing variables outside the scope of the function. So I passed in lines as an argument to get_color and current_point as an argument to get_next_state. Still, I wonder why this is necessary. I thought that I should be able to access module variables from within a module function.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I found out if I relocate these two lines. (see attached) It seems to pass the error.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page