Skip to content

Commit

Permalink
Merge pull request #25 from vermaete/master
Browse files Browse the repository at this point in the history
Register description is not mandatory
  • Loading branch information
oddball committed Apr 9, 2021
2 parents a71e450 + b4a3362 commit 992d257
Show file tree
Hide file tree
Showing 15 changed files with 25 additions and 32 deletions.
4 changes: 1 addition & 3 deletions bin/ipxact2md
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#!/usr/bin/env python3
import configparser
import sys
import os
import argparse
from pprint import pprint

from ipxact2systemverilog.ipxact2hdlCommon import ipxactParser
from ipxact2systemverilog.ipxact2hdlCommon import ipxact2otherGenerator
Expand All @@ -28,7 +26,7 @@ if __name__ == '__main__':
config.read(args.config)
else:
config.read_dict(DEFAULT_INI)

e = ipxactParser(args.srcFile, config)
document = e.returnDocument()
generator = ipxact2otherGenerator(args.destDir)
Expand Down
4 changes: 1 addition & 3 deletions bin/ipxact2rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

import configparser
import sys
import os
import argparse
from pprint import pprint

from ipxact2systemverilog.ipxact2hdlCommon import ipxactParser
from ipxact2systemverilog.ipxact2hdlCommon import ipxact2otherGenerator
Expand All @@ -29,7 +27,7 @@ if __name__ == '__main__':
config.read(args.config)
else:
config.read_dict(DEFAULT_INI)

e = ipxactParser(args.srcFile, config)
document = e.returnDocument()
generator = ipxact2otherGenerator(args.destDir)
Expand Down
3 changes: 1 addition & 2 deletions bin/ipxact2systemverilog
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import configparser
import sys
import os
import argparse

from ipxact2systemverilog.ipxact2hdlCommon import ipxactParser
Expand All @@ -29,7 +28,7 @@ if __name__ == '__main__':
config.read(args.config)
else:
config.read_dict(DEFAULT_INI)

e = ipxactParser(args.srcFile, config)
document = e.returnDocument()
generator = ipxact2otherGenerator(args.destDir)
Expand Down
3 changes: 1 addition & 2 deletions bin/ipxact2vhdl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import configparser
import sys
import os
import argparse

from ipxact2systemverilog.ipxact2hdlCommon import ipxactParser
Expand All @@ -29,7 +28,7 @@ if __name__ == '__main__':
config.read(args.config)
else:
config.read_dict(DEFAULT_INI)

e = ipxactParser(args.srcFile, config)
document = e.returnDocument()
generator = ipxact2otherGenerator(args.destDir)
Expand Down
1 change: 0 additions & 1 deletion example/input/test.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@

<spirit:register>
<spirit:name>reg1</spirit:name>
<spirit:description>write something useful for reg1</spirit:description>
<spirit:addressOffset>1</spirit:addressOffset>
<spirit:size>32</spirit:size>
<spirit:access>read-write</spirit:access>
Expand Down
Binary file modified example/output/example.docx
Binary file not shown.
5 changes: 2 additions & 3 deletions example/output/example.html
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ <h2>Registers</h2>
</tr>
<tr><td><p>0x01</p></td>
<td><p><a class="reference internal" href="#reg1">reg1</a></p></td>
<td><p>write something useful for reg1</p></td>
<td></td>
</tr>
<tr><td><p>0x02</p></td>
<td><p><a class="reference internal" href="#reg2">reg2</a></p></td>
Expand Down Expand Up @@ -675,8 +675,7 @@ <h2>reg1</h2>
<dd><p>read-write</p>
</dd>
<dt>Description</dt>
<dd><p>write something useful for reg1</p>
</dd>
<dd><p></p></dd>
</dl>
<table>
<colgroup>
Expand Down
4 changes: 2 additions & 2 deletions example/output/example.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
|Address|Register Name|Description|
| :--- | :--- | :--- |
|0x00|[reg0](#reg0)|write something useful for reg0|
|0x01|[reg1](#reg1)|write something useful for reg1|
|0x01|[reg1](#reg1)||
|0x02|[reg2](#reg2)|write something useful for reg2|
|0x03|[reg3](#reg3)|write something useful for reg3|
|0x04|[reg4](#reg4)|reg4 is a very useful register. It can take down the moon when configured correctly.|
Expand Down Expand Up @@ -34,7 +34,7 @@
**Address** 0x1
**Reset Value** 0x00000001
**Access** read-write
**Description** write something useful for reg1
**Description**
|Bits|Field name|Reset|Description|
| :--- | :--- | :--- | :--- |
|[31:0]|field0|0x00000001|write something useful for field0|
Expand Down
4 changes: 2 additions & 2 deletions example/output/example.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Registers
+===========+=================+======================================================================================+
| 0x00 | reg0_ | write something useful for reg0 |
+-----------+-----------------+--------------------------------------------------------------------------------------+
| 0x01 | reg1_ | write something useful for reg1 |
| 0x01 | reg1_ | |
+-----------+-----------------+--------------------------------------------------------------------------------------+
| 0x02 | reg2_ | write something useful for reg2 |
+-----------+-----------------+--------------------------------------------------------------------------------------+
Expand Down Expand Up @@ -53,7 +53,7 @@ reg1
:Address: 0x1
:Reset Value: 0x00000001
:Access: read-write
:Description: write something useful for reg1
:Description:

+--------+--------------+------------+-----------------------------------+
| Bits | Field name | Reset | Description |
Expand Down
6 changes: 2 additions & 4 deletions example/output/example.rtf
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ reg1
}}}
\par}
\cell}
{{\pard\intbl \ql \f0 \sa0 \li0 \fi0 write something useful for reg1\par}
\cell}
{\cell}
}
\intbl\row}
{
Expand Down Expand Up @@ -243,8 +242,7 @@ reg7
{\pard \ql \f0 \sa180 \li360 \fi0 0x00000001\par}
{\pard \ql \f0 \sa0 \li0 \fi0 Access\par}
{\pard \ql \f0 \sa180 \li360 \fi0 read-write\par}
{\pard \ql \f0 \sa0 \li0 \fi0 Description\par}
{\pard \ql \f0 \sa180 \li360 \fi0 write something useful for reg1\sa180\par}
{\pard \ql \f0 \sa0 \li0 \fi0 Description\sa180\par}
{
\trowd \trgaph120
\clbrdrb\brdrs\cellx1065\clbrdrb\brdrs\cellx2840\clbrdrb\brdrs\cellx4378\clbrdrb\brdrs\cellx8638
Expand Down
4 changes: 2 additions & 2 deletions example/output_default/example.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
|Address|Register Name|Description|
| :--- | :--- | :--- |
|0x00|[reg0](#reg0)|write something useful for reg0|
|0x01|[reg1](#reg1)|write something useful for reg1|
|0x01|[reg1](#reg1)||
|0x02|[reg2](#reg2)|write something useful for reg2|
|0x03|[reg3](#reg3)|write something useful for reg3|
|0x04|[reg4](#reg4)|reg4 is a very useful register. It can take down the moon when configured correctly.|
Expand Down Expand Up @@ -34,7 +34,7 @@
**Address** 0x1
**Reset Value** 0x00000001
**Access** read-write
**Description** write something useful for reg1
**Description**
|Bits|Field name|Reset|Description|
| :--- | :--- | :--- | :--- |
|[31:0]|field0|0x00000001|write something useful for field0|
Expand Down
4 changes: 2 additions & 2 deletions example/output_default/example.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Registers
+===========+=================+======================================================================================+
| 0x00 | reg0_ | write something useful for reg0 |
+-----------+-----------------+--------------------------------------------------------------------------------------+
| 0x01 | reg1_ | write something useful for reg1 |
| 0x01 | reg1_ | |
+-----------+-----------------+--------------------------------------------------------------------------------------+
| 0x02 | reg2_ | write something useful for reg2 |
+-----------+-----------------+--------------------------------------------------------------------------------------+
Expand Down Expand Up @@ -53,7 +53,7 @@ reg1
:Address: 0x1
:Reset Value: 0x00000001
:Access: read-write
:Description: write something useful for reg1
:Description:

+--------+--------------+------------+-----------------------------------+
| Bits | Field name | Reset | Description |
Expand Down
4 changes: 2 additions & 2 deletions example/output_no_default/example.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
|Address|Register Name|Description|
| :--- | :--- | :--- |
|0x00|[reg0](#reg0)|write something useful for reg0|
|0x01|[reg1](#reg1)|write something useful for reg1|
|0x01|[reg1](#reg1)||
|0x02|[reg2](#reg2)|write something useful for reg2|
|0x03|[reg3](#reg3)|write something useful for reg3|
|0x04|[reg4](#reg4)|reg4 is a very useful register. It can take down the moon when configured correctly.|
Expand Down Expand Up @@ -34,7 +34,7 @@
**Address** 0x1
**Reset Value** 0x00000001
**Access** read-write
**Description** write something useful for reg1
**Description**
|Bits|Field name|Reset|Description|
| :--- | :--- | :--- | :--- |
|[31:0]|field0|0x00000001|write something useful for field0|
Expand Down
4 changes: 2 additions & 2 deletions example/output_no_default/example.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Registers
+===========+=================+======================================================================================+
| 0x00 | reg0_ | write something useful for reg0 |
+-----------+-----------------+--------------------------------------------------------------------------------------+
| 0x01 | reg1_ | write something useful for reg1 |
| 0x01 | reg1_ | |
+-----------+-----------------+--------------------------------------------------------------------------------------+
| 0x02 | reg2_ | write something useful for reg2 |
+-----------+-----------------+--------------------------------------------------------------------------------------+
Expand Down Expand Up @@ -53,7 +53,7 @@ reg1
:Address: 0x1
:Reset Value: 0x00000001
:Access: read-write
:Description: write something useful for reg1
:Description:

+--------+--------------+------------+-----------------------------------+
| Bits | Field name | Reset | Description |
Expand Down
7 changes: 5 additions & 2 deletions ipxact2systemverilog/ipxact2hdlCommon.py
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,10 @@ def returnDocument(self):
resetValue = None
size = int(registerElem.find(spiritString + "size").text, 0)
access = registerElem.find(spiritString + "access").text
desc = registerElem.find(spiritString + "description").text
if registerElem.find(spiritString + "description") != None:
desc = registerElem.find(spiritString + "description").text
else:
desc = ""
regAddress = baseAddress + int(registerElem.find(spiritString + "addressOffset").text, 0)
r = self.returnRegister(spiritString, registerElem, regAddress,
resetValue, size, access, desc, dataWidth)
Expand All @@ -934,7 +937,7 @@ def returnRegister(self, spiritString, registerElem, regAddress, resetValue, siz
if enumeratedValuesElem is not None:
enumeratedValueList = enumeratedValuesElem.findall(spiritString + "enumeratedValue")
valuesNameList = [item.find(spiritString + "name").text for item in enumeratedValueList]
descrList = [item.find(spiritString + "description").text if item.find(spiritString + "description") is not None else "" for item in enumeratedValueList ]
descrList = [item.find(spiritString + "description").text if item.find(spiritString + "description") is not None else "" for item in enumeratedValueList]
valuesList = [item.find(spiritString + "value").text for item in enumeratedValueList]
if len(valuesNameList) > 0:
if int(bitWidth) > 1: # if the field of a enum is longer than 1 bit, always use enums
Expand Down

0 comments on commit 992d257

Please sign in to comment.