1 |
8 |
feddischso |
require_relative '../../lib/soc_maker'
|
2 |
7 |
feddischso |
|
3 |
|
|
options = {}
|
4 |
|
|
options[ :libpath ] = "./core_lib/"
|
5 |
|
|
##
|
6 |
|
|
# initialize SOCMaker core
|
7 |
|
|
# this sets up logging and parses all yaml files
|
8 |
|
|
# found in the configure path (see also soc_maker_conf.rb)
|
9 |
|
|
SOCMaker::load( options )
|
10 |
|
|
|
11 |
|
|
|
12 |
|
|
puts "Library Content:"
|
13 |
|
|
|
14 |
|
|
|
15 |
|
|
puts SOCMaker::lib
|
16 |
|
|
|
17 |
|
|
|
18 |
|
|
SOCMaker::lib.cores do |name_version, core|
|
19 |
|
|
# core.get_files
|
20 |
|
|
end
|
21 |
|
|
|
22 |
|
|
soc = SOCMaker::SOCDef.new( 'or1200_test', 'v1', 'or1200_test' )
|
23 |
|
|
SOCMaker::lib.add_core( soc )
|
24 |
|
|
soc_inst = SOCMaker::CoreInst.new( 'or1200_testv1' )
|
25 |
|
|
#soc_inst.name = "soc_inst"
|
26 |
|
|
|
27 |
|
|
|
28 |
|
|
port = SOCMaker::IfcPort.new( 'clk', 1 )
|
29 |
|
|
ifc = SOCMaker::IfcDef.new( 'clk', '1', 1, { 'clk_i' => port} )
|
30 |
|
|
soc.interfaces[ 'clk_ifc'.to_sym ] = ifc
|
31 |
|
|
|
32 |
|
|
port = SOCMaker::IfcPort.new( 'rst', 1 )
|
33 |
|
|
ifc = SOCMaker::IfcDef.new( 'rst', '1', 1, { 'rst_i' => port} )
|
34 |
|
|
soc.interfaces[ 'rst_ifc'.to_sym ] = ifc
|
35 |
|
|
|
36 |
|
|
soc.interfaces[ 'jtag_ifc'.to_sym ] = SOCMaker::IfcDef.new( 'jtag_tap', '1', 1, {
|
37 |
|
|
'tck_i' => SOCMaker::IfcPort.new( 'tck', 1 ),
|
38 |
|
|
'tdi_i' => SOCMaker::IfcPort.new( 'tdi', 1 ),
|
39 |
|
|
'tdo_o' => SOCMaker::IfcPort.new( 'tdo' ,1 ),
|
40 |
8 |
feddischso |
'debug_rst_i' => SOCMaker::IfcPort.new( 'rst', 1 ),
|
41 |
7 |
feddischso |
'shift_dr_i' => SOCMaker::IfcPort.new( 'shift', 1 ),
|
42 |
|
|
'pause_dr_i' => SOCMaker::IfcPort.new( 'pause', 1 ),
|
43 |
|
|
'update_dr_i' => SOCMaker::IfcPort.new( 'update', 1 ),
|
44 |
|
|
'capture_dr_i' => SOCMaker::IfcPort.new( 'capture', 1 ),
|
45 |
|
|
'debug_select_i' => SOCMaker::IfcPort.new( 'select', 1 ) } )
|
46 |
|
|
|
47 |
8 |
feddischso |
soc.interfaces[ 'uart_ifc'.to_sym ] = SOCMaker::IfcDef.new( 'uart', '1', 1, {
|
48 |
|
|
'stx_pad_o' => SOCMaker::IfcPort.new( 'stx_pad', 1 ),
|
49 |
|
|
'srx_pad_i' => SOCMaker::IfcPort.new( 'srx_pad', 1 ),
|
50 |
|
|
'rts_pad_o' => SOCMaker::IfcPort.new( 'rts_pad', 1 ),
|
51 |
|
|
'cts_pad_i' => SOCMaker::IfcPort.new( 'cts_pad', 1 ),
|
52 |
|
|
'dtr_pad_o' => SOCMaker::IfcPort.new( 'dtr_pad', 1 ),
|
53 |
|
|
'dsr_pad_i' => SOCMaker::IfcPort.new( 'dsr_pad', 1 ),
|
54 |
|
|
'ri_pad_i' => SOCMaker::IfcPort.new( 'ri_pad' , 1 ),
|
55 |
|
|
'dcd_pad_i' => SOCMaker::IfcPort.new( 'dcd_pad', 1 ) } )
|
56 |
7 |
feddischso |
|
57 |
|
|
|
58 |
|
|
soc.add_core( 'or1200', 'rel2', 'cpu' )
|
59 |
|
|
soc.add_core( 'wb_connect', '1', 'wb_bus' )
|
60 |
|
|
soc.add_core( 'adv_debug_sys', 'ads_3', 'dbg' )
|
61 |
8 |
feddischso |
soc.add_core( 'ram_wb', 'b3', 'ram1' )
|
62 |
|
|
soc.add_core( 'ram_wb', 'b3', 'ram2' )
|
63 |
|
|
soc.add_core( 'uart16550', 'rel4', 'uart' )
|
64 |
7 |
feddischso |
soc.consistency_check
|
65 |
|
|
|
66 |
|
|
|
67 |
8 |
feddischso |
#
|
68 |
|
|
# Setup the CPU
|
69 |
|
|
#
|
70 |
|
|
soc.set_sparam( 'or1200rel2', 'VCD_DUMP', false )
|
71 |
|
|
soc.set_sparam( 'or1200rel2', 'VERBOSE', false )
|
72 |
|
|
soc.set_sparam( 'or1200rel2', 'ASIC' , false )
|
73 |
|
|
|
74 |
|
|
soc.set_sparam( 'or1200rel2', 'ASIC_MEM_CHOICE', 0 )
|
75 |
|
|
soc.set_sparam( 'or1200rel2', 'ASIC_NO_DC', true )
|
76 |
|
|
soc.set_sparam( 'or1200rel2', 'ASIC_NO_IC', true )
|
77 |
|
|
soc.set_sparam( 'or1200rel2', 'ASIC_NO_DMMU', true )
|
78 |
|
|
soc.set_sparam( 'or1200rel2', 'ASIC_NO_IMMU', true )
|
79 |
|
|
soc.set_sparam( 'or1200rel2', 'ASIC_MUL_CHOICE', 0 )
|
80 |
|
|
soc.set_sparam( 'or1200rel2', 'ASIC_IC_CHOICE', 0 )
|
81 |
|
|
soc.set_sparam( 'or1200rel2', 'ASIC_DC_CHOICE', 0 )
|
82 |
|
|
|
83 |
|
|
|
84 |
|
|
soc.set_sparam( 'or1200rel2', 'FPGA_MEM_CHOICE', 0 )
|
85 |
|
|
soc.set_sparam( 'or1200rel2', 'FPGA_NO_DC', true )
|
86 |
|
|
soc.set_sparam( 'or1200rel2', 'FPGA_NO_IC', true )
|
87 |
|
|
soc.set_sparam( 'or1200rel2', 'FPGA_NO_DMMU', true )
|
88 |
|
|
soc.set_sparam( 'or1200rel2', 'FPGA_NO_IMMU', true )
|
89 |
|
|
soc.set_sparam( 'or1200rel2', 'FPGA_MUL_CHOICE', 1 )
|
90 |
|
|
soc.set_sparam( 'or1200rel2', 'FPGA_IC_CHOICE', 0 )
|
91 |
|
|
soc.set_sparam( 'or1200rel2', 'FPGA_DC_CHOICE', 0 )
|
92 |
|
|
|
93 |
|
|
#
|
94 |
|
|
# Setup the on-chip memory
|
95 |
|
|
#
|
96 |
|
|
soc.set_sparam( 'ram_wbb3', 'MEM_SIZE', 20 )
|
97 |
|
|
soc.set_sparam( 'ram_wbb3', 'MEM_ADR_WIDTH', 17 )
|
98 |
|
|
|
99 |
|
|
|
100 |
|
|
#
|
101 |
|
|
#
|
102 |
|
|
#
|
103 |
|
|
|
104 |
7 |
feddischso |
soc.add_connection( 'or1200_test', 'clk_ifc', 'cpu', 'clk', 'con_main_clk' )
|
105 |
|
|
soc.add_connection( 'or1200_test', 'rst_ifc', 'cpu', 'rst', 'con_main_rst' )
|
106 |
|
|
soc.add_connection( 'or1200_test', 'clk_ifc', 'wb_bus', 'clk', 'con_main_clk' )
|
107 |
|
|
soc.add_connection( 'or1200_test', 'rst_ifc', 'wb_bus', 'rst', 'con_main_rst' )
|
108 |
|
|
|
109 |
8 |
feddischso |
soc.add_connection( 'wb_bus', 'i3', 'dbg', 'wb_ifc', 'con_wb_debug' )
|
110 |
|
|
soc.add_connection( 'wb_bus', 'i4', 'cpu', 'wb_data', 'con_data' )
|
111 |
|
|
soc.add_connection( 'wb_bus', 'i5', 'cpu', 'wb_instruction', 'con_instruction' )
|
112 |
|
|
soc.add_connection( 'wb_bus', 't0', 'ram1', 'wb_ifc', 'con_ram1' )
|
113 |
|
|
soc.add_connection( 'wb_bus', 't1', 'ram2', 'wb_ifc', 'con_ram2' )
|
114 |
|
|
soc.add_connection( 'wb_bus', 't2', 'uart', 'wb_ifc', 'con_uart' )
|
115 |
7 |
feddischso |
|
116 |
|
|
soc.add_connection( 'dbg', 'cpu0_dbg', 'cpu', 'ext_debug', 'con_debug' )
|
117 |
|
|
|
118 |
|
|
soc.add_connection( 'or1200_test', 'clk_ifc', 'dbg', 'cpu0_dbg_clk', 'con_main_clk' )
|
119 |
8 |
feddischso |
soc.add_connection( 'or1200_test', 'jtag_ifc', 'dbg', 'jtag', 'con_jtag_top' )
|
120 |
|
|
soc.add_connection( 'or1200_test', 'uart_ifc', 'uart', 'uart_ifc', 'con_uart_top' )
|
121 |
7 |
feddischso |
|
122 |
|
|
soc_inst.consistency_check
|
123 |
|
|
soc_inst.gen_toplevel
|
124 |
|
|
|
125 |
|
|
soc.copy_files
|
126 |
|
|
|