|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--org.opencores.verilogp.Parser
Handwriten optimized LL(1) parser that reads data from stream
and builds graph g.
Parser does not use standard parser or lexer builder, since the number of keyword is relatively small, and there is no need to parse complex objects. Only expression part is bit uglier. Java.io.StreamTokenizer is used instead.
NOTE: This parser accept only limited Verilog grammar, which
should come out of design synthesis.
- assign support only maxtern representation
- no tristate wires, etc
- no memory (e.g. X->(X)|~X|X&X
- only one modulereg [31:0] mem [16])
| Field Summary | |
private Dictionary |
d
Dictionary of all names. |
private int |
expr_mark
count for marking added nodes and nets |
private java.lang.String |
filename
File name we are processing |
private Graph |
g
currently built graph |
private int |
lsb
[msb:lsb] from last readRange |
private int |
msb
[msb:lsb] from last readRange |
private VTokenizer |
st
Java's stream tokenizer. |
| Constructor Summary | |
Parser(java.lang.String filename)
parses file and construct graph |
|
| Method Summary | |
private void |
assimilate(Net np,
Net nt)
connects port's net np to net nt |
private java.lang.String |
errorPrefix()
returns error prefix displayed |
Graph |
getGraph()
returns newly built graph |
private void |
module()
parses one module |
private void |
parse()
parses whole file |
private void |
readASSIGN()
processes ASSIGN statement |
private Net |
readExpr()
Reads expression from the stream |
private Net |
readFinal()
Reads final from the stream |
private void |
readIN_OUT(int dir)
processes INPUT / OUTPUT statement |
private int |
readKeyword()
expects keyword on input |
private void |
readKeyword(int k)
expects keyword k on input |
private void |
readModule(java.lang.String name)
reads module from file with same name |
private java.lang.String |
readNewWord()
expects word on input |
private int |
readNumber()
read number |
private java.lang.Object |
readParam()
reads one module parameter |
private java.lang.Object |
readParamSimple()
reads one module parameter inside () (no arrays {}) |
private void |
readRange()
reads [msb:lsb] |
private void |
readSym(int sym)
expects sym on input |
private Net |
readTerminal()
Reads terminal from the stream |
private void |
readWIRE()
processes WIRE statement |
private java.lang.Object |
readWord()
expects non-keyword on input |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
private Graph g
private VTokenizer st
StreamTokenizerprivate Dictionary d
Dictionary of all names.private java.lang.String filename
private int expr_mark
private int msb
private int lsb
| Constructor Detail |
public Parser(java.lang.String filename)
throws java.io.IOException
filename - file to read from| Method Detail |
public Graph getGraph()
private void parse()
throws java.io.IOException
private void module()
throws java.io.IOException
private java.lang.Object readParamSimple()
throws java.io.IOException
private java.lang.Object readParam()
throws java.io.IOException
private void readIN_OUT(int dir)
throws java.io.IOException
private void readWIRE()
throws java.io.IOException
private void readASSIGN()
throws java.io.IOException
private Net readExpr()
throws java.io.IOException
private Net readTerminal()
throws java.io.IOException
private Net readFinal()
throws java.io.IOException
private void readRange()
throws java.io.IOException
private void readSym(int sym)
throws java.io.IOException
private java.lang.Object readWord()
throws java.io.IOException
private java.lang.String readNewWord()
throws java.io.IOException
private void readKeyword(int k)
throws java.io.IOException
private int readNumber()
throws java.io.IOException
private int readKeyword()
throws java.io.IOException
private java.lang.String errorPrefix()
private void readModule(java.lang.String name)
throws java.io.IOException
private void assimilate(Net np,
Net nt)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||