diff --git a/vsg/rules/port/rule_010.py b/vsg/rules/port/rule_010.py index 7c146f9b..722ea576 100644 --- a/vsg/rules/port/rule_010.py +++ b/vsg/rules/port/rule_010.py @@ -1,12 +1,14 @@ -from vsg.rules import uppercase_word_rule +from vsg.rules import case_rule +from vsg import utils -class rule_010(uppercase_word_rule): +class rule_010(case_rule): ''' - Port rule 010 checks port names are uppercase. + Port rule 010 checks port names have proper case. ''' def __init__(self): - uppercase_word_rule.__init__(self, 'port', '010', 'isPortDeclaration', 0) - self.solution = 'Uppercase port name.' + case_rule.__init__(self, 'port', '010', 'isPortDeclaration', utils.extract_port_name) + self.case = 'upper' + self.solution = 'Change port name to ' + self.case + 'case' diff --git a/vsg/tests/code_examples/spi_master.fixed.vhd b/vsg/tests/code_examples/spi_master.fixed.vhd index b7f2f6fa..1842b24b 100644 --- a/vsg/tests/code_examples/spi_master.fixed.vhd +++ b/vsg/tests/code_examples/spi_master.fixed.vhd @@ -193,13 +193,13 @@ entity SPI_MASTER is DI_I : in std_logic_vector(N - 1 downto 0) := (others => 'X'); -- parallel data in (clocked on rising spi_clk after last bit) WREN_I : in std_logic := 'X'; -- user data write enable, starts transmission when interface is idle WR_ACK_O : out std_logic; -- write acknowledge - DO_VALID_O : out std_logic; -- do_o data valid signal, valid during one spi_clk rising edge. + DO_VALID_O : out std_logic; -- DO_O data valid signal, valid during one spi_clk rising edge. DO_O : out std_logic_vector(N - 1 downto 0); -- parallel output (clocked on rising spi_clk after last bit) --- debug ports: can be removed or left unconnected for the application circuit --- SCK_ENA_O : out std_logic; -- debug: internal sck enable signal SCK_ENA_CE_O : out std_logic; -- debug: internal sck clock enable signal DO_TRANSFER_O : out std_logic; -- debug: internal transfer driver - WREN_O : out std_logic; -- debug: internal state of the wren_i pulse stretcher + WREN_O : out std_logic; -- debug: internal state of the WREN_I pulse stretcher RX_BIT_REG_O : out std_logic; -- debug: internal rx bit STATE_DBG_O : out std_logic_vector(3 downto 0); -- debug: internal state register CORE_CLK_O : out std_logic; diff --git a/vsg/tests/code_examples/spi_slave.fixed.vhd b/vsg/tests/code_examples/spi_slave.fixed.vhd index a7555c80..f3b7ad82 100644 --- a/vsg/tests/code_examples/spi_slave.fixed.vhd +++ b/vsg/tests/code_examples/spi_slave.fixed.vhd @@ -155,14 +155,14 @@ entity SPI_SLAVE is SPI_MOSI_I : in std_logic := 'X'; -- spi bus mosi input SPI_MISO_O : out std_logic := 'X'; -- spi bus spi_miso_o output DI_REQ_O : out std_logic; -- preload lookahead data request line - DI_I : in std_logic_vector(N - 1 downto 0) := (others => 'X'); -- parallel load data in (clocked in on rising edge of clk_i) + DI_I : in std_logic_vector(N - 1 downto 0) := (others => 'X'); -- parallel load data in (clocked in on rising edge of CLK_I) WREN_I : in std_logic := 'X'; -- user data write enable WR_ACK_O : out std_logic; -- write acknowledge - DO_VALID_O : out std_logic; -- do_o data valid strobe, valid during one clk_i rising edge. - DO_O : out std_logic_vector(N - 1 downto 0); -- parallel output (clocked out on falling clk_i) + DO_VALID_O : out std_logic; -- DO_O data valid strobe, valid during one CLK_I rising edge. + DO_O : out std_logic_vector(N - 1 downto 0); -- parallel output (clocked out on falling CLK_I) --- debug ports: can be removed for the application circuit --- DO_TRANSFER_O : out std_logic; -- debug: internal transfer driver - WREN_O : out std_logic; -- debug: internal state of the wren_i pulse stretcher + WREN_O : out std_logic; -- debug: internal state of the WREN_I pulse stretcher RX_BIT_NEXT_O : out std_logic; -- debug: internal rx bit STATE_DBG_O : out std_logic_vector(3 downto 0); -- debug: internal state register SH_REG_DBG_O : out std_logic_vector(N - 1 downto 0) -- debug: internal shift register diff --git a/vsg/utils.py b/vsg/utils.py index e2fdc869..7112f71f 100644 --- a/vsg/utils.py +++ b/vsg/utils.py @@ -638,6 +638,20 @@ def extract_entity_identifier(oLine): extract_component_identifier = extract_entity_identifier; +def extract_port_name(oLine): + ''' + Returns the port name. + + Parameters: + + oLine: (line object) + + Returns: (one element list of strings) + ''' + sLine = oLine.line.replace('(', ' ') + return [sLine.split()[0]] + + def remove_comment_attributes_from_line(oLine): ''' Sets all comment attributes on a line to indicate no comment is present.