-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
173 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
module TOP(CLK, RST, WRITE, READ, ADDR, WRITE_DATA, READ_DATA); | ||
input CLK,RST,WRITE,READ; | ||
input [2:0] ADDR; | ||
input [1:0] WRITE_DATA; | ||
output reg [1:0] READ_DATA; | ||
reg [4:3] reg0; | ||
|
||
|
||
|
||
always @(posedge CLK) begin | ||
if(RST) begin | ||
reg0[4:3] <= 0; | ||
end else if(WRITE) begin | ||
case(ADDR) | ||
0:reg0[4:3] <= WRITE_DATA[1:0]; | ||
endcase | ||
//reg0[4:3] <= WRITE_DATA[1:0]; | ||
end | ||
end | ||
|
||
always @* begin | ||
case(ADDR) | ||
0:READ_DATA[1:0] = reg0[4:3]; | ||
endcase | ||
end | ||
|
||
|
||
|
||
endmodule | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
module TOP(CLK, RST, WRITE, READ, ADDR, WRITE_DATA, READ_DATA); | ||
input CLK,RST,WRITE,READ; | ||
input [2:0] ADDR; | ||
input [3:0] WRITE_DATA; | ||
output [3:0] READ_DATA; | ||
|
||
reg [1:0] reg1,reg0; | ||
|
||
always @(posedge CLK) begin | ||
if(RST) begin | ||
reg0[1:0] <= 0; | ||
reg1[1:0] <= 0; | ||
end else if(WRITE) begin | ||
case(ADDR) | ||
1:{reg1[1:0], reg0[1:0]} <= WRITE_DATA[3:0]; | ||
endcase | ||
end | ||
end | ||
|
||
endmodule | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
#------------------------------------------------------------------------------- | ||
# get_dataflow_facade.py | ||
# | ||
# interface of register map analyzer | ||
# | ||
# | ||
# Copyright (C) 2015, Ryosuke Fukatani | ||
# License: Apache 2.0 | ||
#------------------------------------------------------------------------------- | ||
|
||
|
||
import sys | ||
import os | ||
import pyverilog | ||
|
||
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) ) | ||
|
||
import pyverilog.controlflow.controlflow_analyzer as controlflow_analyzer | ||
from optparse import OptionParser | ||
import pyverilog.utils.util as util | ||
from pyverilog.dataflow.dataflow_analyzer import VerilogDataflowAnalyzer | ||
from pyverilog.dataflow.optimizer import VerilogDataflowOptimizer | ||
from bindlibrary import BindLibrary | ||
from pyverilog.controlflow.controlflow_analyzer import VerilogControlflowAnalyzer | ||
|
||
class dataflow_facade(VerilogControlflowAnalyzer): | ||
def __init__(self, code_file_name,setup_file): | ||
topmodule, terms, binddict, resolved_terms, resolved_binddict, constlist = self.get_dataflow(code_file_name,setup_file) | ||
VerilogControlflowAnalyzer.__init__(self, topmodule, terms, binddict, | ||
resolved_terms, resolved_binddict,constlist) | ||
self.binds = BindLibrary(binddict, terms) | ||
|
||
def get_dataflow(self, code_file_name,setup_file): | ||
optparser = OptionParser() | ||
optparser.add_option("-t","--top",dest="topmodule", | ||
default="TOP",help="Top module, Default=TOP") | ||
|
||
optparser.add_option("-I","--include",dest="include",action="append", | ||
default=[],help="Include path") | ||
optparser.add_option("-D",dest="define",action="append", | ||
default=[],help="Macro Definition") | ||
optparser.add_option("-S",dest="regmap_config", | ||
default=[],help="regmap config") | ||
|
||
(options, args) = optparser.parse_args() | ||
|
||
if args: | ||
filelist = args | ||
else: | ||
filelist = {code_file_name} | ||
|
||
if options.regmap_config: | ||
self.setup_file = options.regmap_config | ||
|
||
for f in filelist: | ||
if not os.path.exists(f): raise IOError("file not found: " + f) | ||
|
||
analyzer = VerilogDataflowAnalyzer(filelist, options.topmodule, | ||
preprocess_include=options.include, | ||
preprocess_define=options.define) | ||
analyzer.generate() | ||
|
||
directives = analyzer.get_directives() | ||
terms = analyzer.getTerms() | ||
binddict = analyzer.getBinddict() | ||
|
||
optimizer = VerilogDataflowOptimizer(terms, binddict) | ||
|
||
optimizer.resolveConstant() | ||
resolved_terms = optimizer.getResolvedTerms() | ||
resolved_binddict = optimizer.getResolvedBinddict() | ||
constlist = optimizer.getConstlist() | ||
return options.topmodule, terms, binddict, resolved_terms, resolved_binddict, constlist | ||
|
||
def print_bind_info(self): | ||
binds = BindLibrary(self.resolved_binddict, self.resolved_terms) | ||
for tv,tk,bvi,bit,term_lsb in binds.walk_reg_each_bit(): | ||
tree = self.makeTree(tk) | ||
trees = binds.extract_all_dfxxx(tree, set([]), term_lsb, bit, pyverilog.dataflow.dataflow.DFTerminal) | ||
print str(tk) + '[' + str(bit) + ']' + str(trees) | ||
|
||
if __name__ == '__main__': | ||
df = dataflow_facade("../testcode/regmap2.v", "../testcode/setup.txt") | ||
df.print_bind_info() |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.