我正在使用 Lattice Diamond 并且我有一个带有一堆`define 语句来定义全局常量的 verilog 文件。
我将此“头”文件包含到另一个文件中。它找到了文件,但有一个错误:
“ 2049990 错误 - C:/_libraries/LatticeDiamond/verilog-uart/source/uart/uart_loopback_tb.v(184,38-184,53) (VERI-1128) UART_1_STOP_BIT 未声明”
我也将头文件的目录设置为项目设置中的包含路径以用于实现。
/********************************************************************************************
* @file UART_Header.v
* @brief
* Defines UART module parameter constants
*
* @details
* This file is to support the UART_core.v
*
*
* @namespace UART_
********************************************************************************************/
`ifndef UART_HEADER_FILE
`define UART_HEADER_FILE
// UART core register addresses
`define UART_WRITE_ADDR = 8'h00; ///< UART TX address
`define UART_READ_ADDR = 8'h00; ///< UART address to read received data
`define UART_LCR_ADDR = 8'h03; ///< Line control register
`define UART_LSR_ADDR = 8'h05; ///< Line status register
`define UART_DIV_LW_ADDR = 8'b00000111; ///< Baud Rate divisor register low word
`define UART_DIV_HW_ADDR = 8'b00000110; ///< Baud Rate divisor register high word
// UART core bit masks
`define UART_5_DATA_BITS = 16'b00000000; ///< 5 data bits mask
`define UART_6_DATA_BITS = 16'b00000001; ///< 6 data bits mask
`define UART_7_DATA_BITS = 16'b00000010; ///< 7 data bits mask
`define UART_8_DATA_BITS = 16'b00000011; ///< 8 data bits mask
`define UART_1_STOP_BIT = 16'b00000000; ///< 1 stop bit mask
`define UART_1_5_STOP_BIT = 16'b00000100; ///< 1.5 stop bits mask
`define UART_2_STOP_BIT = 16'b00001000; ///< 2 stop bits mask
`define UART_PARITY_ENABLE = 16'b00010000; ///< Enable parity bit mask
`define UART_PARITY_DISABLE = 16'b00000000; ///< Disable parity bit mask
`endif
//EOF
然后我有一个包含该文件的文件,如下所示。
`ifndef UART_LOOPBACK_TB_FILE
`define UART_LOOPBACK_TB_FILE
//*******************************************************************************************
// Includes
//*******************************************************************************************
`include "source/uart/UART_header.v"
// Rest of the code for this file
.....................
UL_TB_WriteReg((UART_8_DATA_BITS | UART_1_STOP_BIT | UART_PARITY_DISABLE), UART_LCR_ADDR);
...................
`endif
为什么它找不到我的`定义?包含头文件的文件甚至与头文件本身位于同一目录中。Lattice Diamond 是否支持这一点?
我也尝试了 `include "UART_header.v" 因为它在同一个目录中,但这给出了同样的错误。