vertigo_vhdl 0.8.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/bin/vertigo +7 -0
- data/lib/vertigo.rb +4 -0
- data/lib/vertigo/ast.rb +87 -0
- data/lib/vertigo/ast_vertigo_rkgen.rb +607 -0
- data/lib/vertigo/code.rb +57 -0
- data/lib/vertigo/compiler.rb +61 -0
- data/lib/vertigo/generic_lexer.rb +61 -0
- data/lib/vertigo/generic_parser.rb +44 -0
- data/lib/vertigo/indent.rb +20 -0
- data/lib/vertigo/lexer.rb +172 -0
- data/lib/vertigo/parser.rb +1458 -0
- data/lib/vertigo/pretty_printer.rb +749 -0
- data/lib/vertigo/runner.rb +115 -0
- data/lib/vertigo/tb_generator.rb +81 -0
- data/lib/vertigo/template.tb.vhd +72 -0
- data/lib/vertigo/token.rb +67 -0
- data/lib/vertigo/version.rb +3 -0
- data/lib/vertigo/vertigo.rkg +354 -0
- data/lib/vertigo/visitor_vertigo_rkgen.rb +447 -0
- data/tests/ghdl_tests/fsm.vhd +98 -0
- data/tests/ghdl_tests/fsm_synth.vhd +248 -0
- data/tests/ghdl_tests/test_fsm.vhd +162 -0
- data/tests/parser_tests/else.vhd +64 -0
- data/tests/parser_tests/test_MUST_fail.vhd +1 -0
- data/tests/parser_tests/test_accelerator.vhd +160 -0
- data/tests/parser_tests/test_accelerator_pp.vhd +144 -0
- data/tests/parser_tests/test_aggregate.vhd +17 -0
- data/tests/parser_tests/test_aggregate_pp.vhd +15 -0
- data/tests/parser_tests/test_archi_1.vhd +45 -0
- data/tests/parser_tests/test_archi_1_pp.vhd +41 -0
- data/tests/parser_tests/test_array_array_00.vhd +25 -0
- data/tests/parser_tests/test_array_array_00_pp.vhd +25 -0
- data/tests/parser_tests/test_array_urange.vhd +25 -0
- data/tests/parser_tests/test_array_urange_pp.vhd +25 -0
- data/tests/parser_tests/test_chu-1.vhd +80 -0
- data/tests/parser_tests/test_chu-1_pp.vhd +104 -0
- data/tests/parser_tests/test_concat.vhd +11 -0
- data/tests/parser_tests/test_concat_pp.vhd +14 -0
- data/tests/parser_tests/test_counter.vhd +35 -0
- data/tests/parser_tests/test_counter_pp.vhd +35 -0
- data/tests/parser_tests/test_de2.vhd +358 -0
- data/tests/parser_tests/test_de2_pp.vhd +274 -0
- data/tests/parser_tests/test_encode.vhd +2679 -0
- data/tests/parser_tests/test_encode_pp.vhd +2549 -0
- data/tests/parser_tests/test_fsm.vhd +162 -0
- data/tests/parser_tests/test_fsm_pp.vhd +125 -0
- data/tests/parser_tests/test_fsm_synth.vhd +248 -0
- data/tests/parser_tests/test_fsm_synth_pp.vhd +197 -0
- data/tests/parser_tests/test_function-01.vhd +33 -0
- data/tests/parser_tests/test_function-01_pp.vhd +18 -0
- data/tests/parser_tests/test_lfsr.vhd +75 -0
- data/tests/parser_tests/test_lfsr_pp.vhd +44 -0
- data/tests/parser_tests/test_microwatt_cache_ram.vhd +1 -0
- data/tests/parser_tests/test_microwatt_cache_ram_pp.vhd +68 -0
- data/tests/parser_tests/test_microwatt_common.vhd +1 -0
- data/tests/parser_tests/test_microwatt_common_pp.vhd +336 -0
- data/tests/parser_tests/test_microwatt_control.vhd +1 -0
- data/tests/parser_tests/test_microwatt_control_pp.vhd +187 -0
- data/tests/parser_tests/test_microwatt_core.vhd +1 -0
- data/tests/parser_tests/test_microwatt_core_debug.vhd +1 -0
- data/tests/parser_tests/test_microwatt_core_debug_pp.vhd +104 -0
- data/tests/parser_tests/test_microwatt_core_pp.vhd +231 -0
- data/tests/parser_tests/test_microwatt_core_tb.vhd +1 -0
- data/tests/parser_tests/test_microwatt_core_tb_pp.vhd +43 -0
- data/tests/parser_tests/test_microwatt_countzero.vhd +1 -0
- data/tests/parser_tests/test_microwatt_countzero_pp.vhd +120 -0
- data/tests/parser_tests/test_microwatt_countzero_tb.vhd +1 -0
- data/tests/parser_tests/test_microwatt_countzero_tb_pp.vhd +70 -0
- data/tests/parser_tests/test_microwatt_cr_file.vhd +1 -0
- data/tests/parser_tests/test_microwatt_cr_file_pp.vhd +74 -0
- data/tests/parser_tests/test_microwatt_cr_hazard.vhd +1 -0
- data/tests/parser_tests/test_microwatt_cr_hazard_pp.vhd +51 -0
- data/tests/parser_tests/test_microwatt_crhelpers.vhd +1 -0
- data/tests/parser_tests/test_microwatt_crhelpers_pp.vhd +48 -0
- data/tests/parser_tests/test_microwatt_dcache.vhd +1 -0
- data/tests/parser_tests/test_microwatt_dcache_pp.vhd +481 -0
- data/tests/parser_tests/test_microwatt_dcache_tb.vhd +1 -0
- data/tests/parser_tests/test_microwatt_dcache_tb_pp.vhd +98 -0
- data/tests/parser_tests/test_microwatt_decode1.vhd +1 -0
- data/tests/parser_tests/test_microwatt_decode1_pp.vhd +138 -0
- data/tests/parser_tests/test_microwatt_decode2.vhd +1 -0
- data/tests/parser_tests/test_microwatt_decode2_pp.vhd +300 -0
- data/tests/parser_tests/test_microwatt_decode_types.vhd +1 -0
- data/tests/parser_tests/test_microwatt_decode_types_pp.vhd +67 -0
- data/tests/parser_tests/test_microwatt_divider.vhd +1 -0
- data/tests/parser_tests/test_microwatt_divider_pp.vhd +132 -0
- data/tests/parser_tests/test_microwatt_divider_tb.vhd +1 -0
- data/tests/parser_tests/test_microwatt_divider_tb_pp.vhd +95 -0
- data/tests/parser_tests/test_microwatt_dmi_dtm_dummy.vhd +1 -0
- data/tests/parser_tests/test_microwatt_dmi_dtm_dummy_pp.vhd +29 -0
- data/tests/parser_tests/test_microwatt_dmi_dtm_tb.vhd +1 -0
- data/tests/parser_tests/test_microwatt_dmi_dtm_tb_pp.vhd +197 -0
- data/tests/parser_tests/test_microwatt_dmi_dtm_xilinx.vhd +1 -0
- data/tests/parser_tests/test_microwatt_dmi_dtm_xilinx_pp.vhd +139 -0
- data/tests/parser_tests/test_microwatt_execute1.vhd +1 -0
- data/tests/parser_tests/test_microwatt_execute1_pp.vhd +689 -0
- data/tests/parser_tests/test_microwatt_fetch1.vhd +1 -0
- data/tests/parser_tests/test_microwatt_fetch1_pp.vhd +88 -0
- data/tests/parser_tests/test_microwatt_fetch2.vhd +1 -0
- data/tests/parser_tests/test_microwatt_fetch2_pp.vhd +79 -0
- data/tests/parser_tests/test_microwatt_glibc_random.vhd +1 -0
- data/tests/parser_tests/test_microwatt_glibc_random_helpers.vhd +1 -0
- data/tests/parser_tests/test_microwatt_glibc_random_helpers_pp.vhd +25 -0
- data/tests/parser_tests/test_microwatt_glibc_random_pp.vhd +41 -0
- data/tests/parser_tests/test_microwatt_gpr_hazard.vhd +1 -0
- data/tests/parser_tests/test_microwatt_gpr_hazard_pp.vhd +68 -0
- data/tests/parser_tests/test_microwatt_helpers.vhd +1 -0
- data/tests/parser_tests/test_microwatt_helpers_pp.vhd +153 -0
- data/tests/parser_tests/test_microwatt_icache.vhd +1 -0
- data/tests/parser_tests/test_microwatt_icache_pp.vhd +337 -0
- data/tests/parser_tests/test_microwatt_icache_tb.vhd +1 -0
- data/tests/parser_tests/test_microwatt_icache_tb_pp.vhd +104 -0
- data/tests/parser_tests/test_microwatt_insn_helpers.vhd +1 -0
- data/tests/parser_tests/test_microwatt_insn_helpers_pp.vhd +208 -0
- data/tests/parser_tests/test_microwatt_loadstore1.vhd +1 -0
- data/tests/parser_tests/test_microwatt_loadstore1_pp.vhd +222 -0
- data/tests/parser_tests/test_microwatt_logical.vhd +1 -0
- data/tests/parser_tests/test_microwatt_logical_pp.vhd +87 -0
- data/tests/parser_tests/test_microwatt_multiply.vhd +1 -0
- data/tests/parser_tests/test_microwatt_multiply_pp.vhd +84 -0
- data/tests/parser_tests/test_microwatt_multiply_tb.vhd +1 -0
- data/tests/parser_tests/test_microwatt_multiply_tb_pp.vhd +75 -0
- data/tests/parser_tests/test_microwatt_plru.vhd +1 -0
- data/tests/parser_tests/test_microwatt_plru_pp.vhd +46 -0
- data/tests/parser_tests/test_microwatt_plru_tb.vhd +1 -0
- data/tests/parser_tests/test_microwatt_plru_tb_pp.vhd +93 -0
- data/tests/parser_tests/test_microwatt_ppc_fx_insns.vhd +1 -0
- data/tests/parser_tests/test_microwatt_ppc_fx_insns_pp.vhd +665 -0
- data/tests/parser_tests/test_microwatt_register_file.vhd +1 -0
- data/tests/parser_tests/test_microwatt_register_file_pp.vhd +86 -0
- data/tests/parser_tests/test_microwatt_rotator.vhd +1 -0
- data/tests/parser_tests/test_microwatt_rotator_pp.vhd +149 -0
- data/tests/parser_tests/test_microwatt_rotator_tb.vhd +1 -0
- data/tests/parser_tests/test_microwatt_rotator_tb_pp.vhd +134 -0
- data/tests/parser_tests/test_microwatt_sim_bram.vhd +1 -0
- data/tests/parser_tests/test_microwatt_sim_bram_helpers.vhd +1 -0
- data/tests/parser_tests/test_microwatt_sim_bram_helpers_pp.vhd +52 -0
- data/tests/parser_tests/test_microwatt_sim_bram_pp.vhd +53 -0
- data/tests/parser_tests/test_microwatt_sim_console.vhd +1 -0
- data/tests/parser_tests/test_microwatt_sim_console_pp.vhd +43 -0
- data/tests/parser_tests/test_microwatt_sim_jtag.vhd +1 -0
- data/tests/parser_tests/test_microwatt_sim_jtag_pp.vhd +64 -0
- data/tests/parser_tests/test_microwatt_sim_jtag_socket.vhd +1 -0
- data/tests/parser_tests/test_microwatt_sim_jtag_socket_pp.vhd +36 -0
- data/tests/parser_tests/test_microwatt_sim_uart.vhd +1 -0
- data/tests/parser_tests/test_microwatt_sim_uart_pp.vhd +90 -0
- data/tests/parser_tests/test_microwatt_soc.vhd +1 -0
- data/tests/parser_tests/test_microwatt_soc_pp.vhd +195 -0
- data/tests/parser_tests/test_microwatt_utils.vhd +1 -0
- data/tests/parser_tests/test_microwatt_utils_pp.vhd +39 -0
- data/tests/parser_tests/test_microwatt_wishbone_arbiter.vhd +1 -0
- data/tests/parser_tests/test_microwatt_wishbone_arbiter_pp.vhd +54 -0
- data/tests/parser_tests/test_microwatt_wishbone_bram_tb.vhd +1 -0
- data/tests/parser_tests/test_microwatt_wishbone_bram_tb_pp.vhd +157 -0
- data/tests/parser_tests/test_microwatt_wishbone_bram_wrapper.vhd +1 -0
- data/tests/parser_tests/test_microwatt_wishbone_bram_wrapper_pp.vhd +62 -0
- data/tests/parser_tests/test_microwatt_wishbone_debug_master.vhd +1 -0
- data/tests/parser_tests/test_microwatt_wishbone_debug_master_pp.vhd +124 -0
- data/tests/parser_tests/test_microwatt_wishbone_types.vhd +1 -0
- data/tests/parser_tests/test_microwatt_wishbone_types_pp.vhd +38 -0
- data/tests/parser_tests/test_microwatt_writeback.vhd +1 -0
- data/tests/parser_tests/test_microwatt_writeback_pp.vhd +87 -0
- data/tests/parser_tests/test_package-1.vhd +68 -0
- data/tests/parser_tests/test_package-1_pp.vhd +53 -0
- data/tests/parser_tests/test_precedence.vhd +13 -0
- data/tests/parser_tests/test_precedence_pp.vhd +16 -0
- data/tests/parser_tests/test_selected_sig.vhd +14 -0
- data/tests/parser_tests/test_selected_sig_pp.vhd +10 -0
- data/tests/parser_tests/test_slice.vhd +15 -0
- data/tests/parser_tests/test_slice_pp.vhd +16 -0
- data/tests/parser_tests/test_tb-00.vhd +94 -0
- data/tests/parser_tests/test_tb-00_pp.vhd +71 -0
- data/tests/parser_tests/test_type_decl_02.vhd +9 -0
- data/tests/parser_tests/test_type_decl_02_pp.vhd +11 -0
- data/tests/parser_tests/test_use.vhd +7 -0
- data/tests/parser_tests/test_use_pp.vhd +10 -0
- data/tests/parser_tests/test_while_1.vhd +38 -0
- data/tests/parser_tests/test_while_1_pp.vhd +26 -0
- data/tests/parser_tests/test_with-00.vhd +21 -0
- data/tests/parser_tests/test_with-00_pp.vhd +12 -0
- data/tests/tb_gen_tests/test_accelerator.vhd +160 -0
- metadata +224 -0
@@ -0,0 +1,447 @@
|
|
1
|
+
# ============================================================
|
2
|
+
# This code was generated by rkgen utility.
|
3
|
+
# DO NOT MODIFY !
|
4
|
+
# ============================================================
|
5
|
+
|
6
|
+
module Vertigo
|
7
|
+
|
8
|
+
class Visitor
|
9
|
+
def visit ast
|
10
|
+
puts "visiting ast #{ast}"
|
11
|
+
ast.accept(self)
|
12
|
+
end
|
13
|
+
|
14
|
+
def visitRoot(root_,args=nil)
|
15
|
+
root_.design_units.each{|design_unit_| design_unit_.accept(self,args)}
|
16
|
+
end
|
17
|
+
|
18
|
+
def visitComment(comment_,args=nil)
|
19
|
+
comment_.str.accept(self,args)
|
20
|
+
end
|
21
|
+
|
22
|
+
def visitLibrary(library_,args=nil)
|
23
|
+
library_.name.accept(self,args)
|
24
|
+
end
|
25
|
+
|
26
|
+
def visitUse(use_,args=nil)
|
27
|
+
use_.library.accept(self,args)
|
28
|
+
use_.package.accept(self,args)
|
29
|
+
use_.element.accept(self,args)
|
30
|
+
end
|
31
|
+
|
32
|
+
def visitEntity(entity_,args=nil)
|
33
|
+
entity_.name.accept(self,args)
|
34
|
+
entity_.generics.each{|generic_| generic_.accept(self,args)}
|
35
|
+
entity_.ports.each{|port_| port_.accept(self,args)}
|
36
|
+
end
|
37
|
+
|
38
|
+
def visitGeneric(generic_,args=nil)
|
39
|
+
generic_.name.accept(self,args)
|
40
|
+
generic_.type.accept(self,args)
|
41
|
+
generic_.init.accept(self,args)
|
42
|
+
end
|
43
|
+
|
44
|
+
def visitInput(input_,args=nil)
|
45
|
+
input_.name.accept(self,args)
|
46
|
+
input_.type.accept(self,args)
|
47
|
+
input_.init.accept(self,args)
|
48
|
+
end
|
49
|
+
|
50
|
+
def visitOutput(output_,args=nil)
|
51
|
+
output_.name.accept(self,args)
|
52
|
+
output_.type.accept(self,args)
|
53
|
+
output_.init.accept(self,args)
|
54
|
+
end
|
55
|
+
|
56
|
+
def visitInOut(inout_,args=nil)
|
57
|
+
inout_.name.accept(self,args)
|
58
|
+
inout_.type.accept(self,args)
|
59
|
+
inout_.init.accept(self,args)
|
60
|
+
end
|
61
|
+
|
62
|
+
def visitPackage(package_,args=nil)
|
63
|
+
package_.name.accept(self,args)
|
64
|
+
package_.decls.each{|decl_| decl_.accept(self,args)}
|
65
|
+
end
|
66
|
+
|
67
|
+
def visitPackageBody(packagebody_,args=nil)
|
68
|
+
packagebody_.name.accept(self,args)
|
69
|
+
packagebody_.decls.each{|decl_| decl_.accept(self,args)}
|
70
|
+
end
|
71
|
+
|
72
|
+
def visitProcedureDecl(proceduredecl_,args=nil)
|
73
|
+
proceduredecl_.name.accept(self,args)
|
74
|
+
proceduredecl_.formal_args.each{|formal_arg_| formal_arg_.accept(self,args)}
|
75
|
+
proceduredecl_.decls.each{|decl_| decl_.accept(self,args)}
|
76
|
+
proceduredecl_.body.accept(self,args)
|
77
|
+
end
|
78
|
+
|
79
|
+
def visitFormalArg(formalarg_,args=nil)
|
80
|
+
formalarg_.signal.accept(self,args)
|
81
|
+
formalarg_.direction.accept(self,args)
|
82
|
+
formalarg_.name.accept(self,args)
|
83
|
+
formalarg_.type.accept(self,args)
|
84
|
+
end
|
85
|
+
|
86
|
+
def visitProcedureCall(procedurecall_,args=nil)
|
87
|
+
procedurecall_.name.accept(self,args)
|
88
|
+
procedurecall_.actual_args.each{|actual_arg_| actual_arg_.accept(self,args)}
|
89
|
+
end
|
90
|
+
|
91
|
+
def visitArchitecture(architecture_,args=nil)
|
92
|
+
architecture_.name.accept(self,args)
|
93
|
+
architecture_.entity_name.accept(self,args)
|
94
|
+
architecture_.decls.each{|decl_| decl_.accept(self,args)}
|
95
|
+
architecture_.body.accept(self,args)
|
96
|
+
end
|
97
|
+
|
98
|
+
def visitBody(body_,args=nil)
|
99
|
+
body_.elements.each{|element_| element_.accept(self,args)}
|
100
|
+
end
|
101
|
+
|
102
|
+
def visitProcess(process_,args=nil)
|
103
|
+
process_.sensitivity.accept(self,args)
|
104
|
+
process_.decls.each{|decl_| decl_.accept(self,args)}
|
105
|
+
process_.body.accept(self,args)
|
106
|
+
end
|
107
|
+
|
108
|
+
def visitSensitivity(sensitivity_,args=nil)
|
109
|
+
sensitivity_.elements.each{|element_| element_.accept(self,args)}
|
110
|
+
end
|
111
|
+
|
112
|
+
def visitEntityInstance(entityinstance_,args=nil)
|
113
|
+
entityinstance_.full_name.accept(self,args)
|
114
|
+
entityinstance_.arch_name.accept(self,args)
|
115
|
+
entityinstance_.generic_map.accept(self,args)
|
116
|
+
entityinstance_.port_map.accept(self,args)
|
117
|
+
end
|
118
|
+
|
119
|
+
def visitComponentDecl(componentdecl_,args=nil)
|
120
|
+
componentdecl_.name.accept(self,args)
|
121
|
+
componentdecl_.generics.each{|generic_| generic_.accept(self,args)}
|
122
|
+
componentdecl_.ports.each{|port_| port_.accept(self,args)}
|
123
|
+
end
|
124
|
+
|
125
|
+
def visitComponentInstance(componentinstance_,args=nil)
|
126
|
+
componentinstance_.name.accept(self,args)
|
127
|
+
componentinstance_.generic_map.accept(self,args)
|
128
|
+
componentinstance_.port_map.accept(self,args)
|
129
|
+
end
|
130
|
+
|
131
|
+
def visitPortMap(portmap_,args=nil)
|
132
|
+
portmap_.elements.each{|element_| element_.accept(self,args)}
|
133
|
+
end
|
134
|
+
|
135
|
+
def visitGenericMap(genericmap_,args=nil)
|
136
|
+
genericmap_.elements.each{|element_| element_.accept(self,args)}
|
137
|
+
end
|
138
|
+
|
139
|
+
def visitMap(map_,args=nil)
|
140
|
+
map_.lhs.accept(self,args)
|
141
|
+
map_.rhs.accept(self,args)
|
142
|
+
end
|
143
|
+
|
144
|
+
def visitAttributeDecl(attributedecl_,args=nil)
|
145
|
+
attributedecl_.name.accept(self,args)
|
146
|
+
attributedecl_.type.accept(self,args)
|
147
|
+
end
|
148
|
+
|
149
|
+
def visitAttributeSpec(attributespec_,args=nil)
|
150
|
+
attributespec_.name.accept(self,args)
|
151
|
+
attributespec_.entity_spec.accept(self,args)
|
152
|
+
attributespec_.expr.accept(self,args)
|
153
|
+
end
|
154
|
+
|
155
|
+
def visitEntitySpec(entityspec_,args=nil)
|
156
|
+
entityspec_.elements.each{|element_| element_.accept(self,args)}
|
157
|
+
entityspec_.entity_class.accept(self,args)
|
158
|
+
end
|
159
|
+
|
160
|
+
def visitSigAssign(sigassign_,args=nil)
|
161
|
+
sigassign_.lhs.accept(self,args)
|
162
|
+
sigassign_.rhs.accept(self,args)
|
163
|
+
end
|
164
|
+
|
165
|
+
def visitVarAssign(varassign_,args=nil)
|
166
|
+
varassign_.lhs.accept(self,args)
|
167
|
+
varassign_.rhs.accept(self,args)
|
168
|
+
end
|
169
|
+
|
170
|
+
def visitWait(wait_,args=nil)
|
171
|
+
wait_.until_.accept(self,args)
|
172
|
+
wait_.for_.accept(self,args)
|
173
|
+
end
|
174
|
+
|
175
|
+
def visitIf(if_,args=nil)
|
176
|
+
if_.cond.accept(self,args)
|
177
|
+
if_.body.accept(self,args)
|
178
|
+
if_.elsifs.each{|elsif_| elsif_.accept(self,args)}
|
179
|
+
if_.else_.accept(self,args)
|
180
|
+
end
|
181
|
+
|
182
|
+
def visitElsif(elsif_,args=nil)
|
183
|
+
elsif_.cond.accept(self,args)
|
184
|
+
elsif_.body.accept(self,args)
|
185
|
+
end
|
186
|
+
|
187
|
+
def visitElse(else_,args=nil)
|
188
|
+
else_.body.accept(self,args)
|
189
|
+
end
|
190
|
+
|
191
|
+
def visitCase(case_,args=nil)
|
192
|
+
case_.expr.accept(self,args)
|
193
|
+
case_.whens.each{|when_| when_.accept(self,args)}
|
194
|
+
end
|
195
|
+
|
196
|
+
def visitCaseWhen(casewhen_,args=nil)
|
197
|
+
casewhen_.expr.accept(self,args)
|
198
|
+
casewhen_.body.accept(self,args)
|
199
|
+
end
|
200
|
+
|
201
|
+
def visitAlternative(alternative_,args=nil)
|
202
|
+
alternative_.elements.each{|element_| element_.accept(self,args)}
|
203
|
+
end
|
204
|
+
|
205
|
+
def visitNullStmt(nullstmt_,args=nil)
|
206
|
+
nullstmt_.dummy.accept(self,args)
|
207
|
+
end
|
208
|
+
|
209
|
+
def visitAssert(assert_,args=nil)
|
210
|
+
assert_.cond.accept(self,args)
|
211
|
+
assert_.report.accept(self,args)
|
212
|
+
assert_.severity.accept(self,args)
|
213
|
+
end
|
214
|
+
|
215
|
+
def visitReport(report_,args=nil)
|
216
|
+
report_.expr.accept(self,args)
|
217
|
+
report_.severity.accept(self,args)
|
218
|
+
end
|
219
|
+
|
220
|
+
def visitSeverity(severity_,args=nil)
|
221
|
+
severity_.type.accept(self,args)
|
222
|
+
end
|
223
|
+
|
224
|
+
def visitReturn(return_,args=nil)
|
225
|
+
return_.expr.accept(self,args)
|
226
|
+
end
|
227
|
+
|
228
|
+
def visitWithSelect(withselect_,args=nil)
|
229
|
+
withselect_.with_expr.accept(self,args)
|
230
|
+
withselect_.assigned.accept(self,args)
|
231
|
+
withselect_.selected_whens.each{|selected_when_| selected_when_.accept(self,args)}
|
232
|
+
end
|
233
|
+
|
234
|
+
def visitSelectedWhen(selectedwhen_,args=nil)
|
235
|
+
selectedwhen_.lhs.accept(self,args)
|
236
|
+
selectedwhen_.rhs.accept(self,args)
|
237
|
+
end
|
238
|
+
|
239
|
+
def visitIfGenerate(ifgenerate_,args=nil)
|
240
|
+
ifgenerate_.cond.accept(self,args)
|
241
|
+
ifgenerate_.body.accept(self,args)
|
242
|
+
end
|
243
|
+
|
244
|
+
def visitForGenerate(forgenerate_,args=nil)
|
245
|
+
forgenerate_.index.accept(self,args)
|
246
|
+
forgenerate_.range.accept(self,args)
|
247
|
+
forgenerate_.decls.each{|decl_| decl_.accept(self,args)}
|
248
|
+
forgenerate_.body.accept(self,args)
|
249
|
+
end
|
250
|
+
|
251
|
+
def visitIsolatedRange(isolatedrange_,args=nil)
|
252
|
+
isolatedrange_.lhs.accept(self,args)
|
253
|
+
isolatedrange_.rhs.accept(self,args)
|
254
|
+
end
|
255
|
+
|
256
|
+
def visitTypeDecl(typedecl_,args=nil)
|
257
|
+
typedecl_.name.accept(self,args)
|
258
|
+
typedecl_.spec.accept(self,args)
|
259
|
+
end
|
260
|
+
|
261
|
+
def visitSubTypeDecl(subtypedecl_,args=nil)
|
262
|
+
subtypedecl_.name.accept(self,args)
|
263
|
+
subtypedecl_.spec.accept(self,args)
|
264
|
+
end
|
265
|
+
|
266
|
+
def visitEnumDecl(enumdecl_,args=nil)
|
267
|
+
enumdecl_.elements.each{|element_| element_.accept(self,args)}
|
268
|
+
end
|
269
|
+
|
270
|
+
def visitRecordDecl(recorddecl_,args=nil)
|
271
|
+
recorddecl_.elements.each{|element_| element_.accept(self,args)}
|
272
|
+
end
|
273
|
+
|
274
|
+
def visitRecordItem(recorditem_,args=nil)
|
275
|
+
recorditem_.name.accept(self,args)
|
276
|
+
recorditem_.type.accept(self,args)
|
277
|
+
end
|
278
|
+
|
279
|
+
def visitArrayDecl(arraydecl_,args=nil)
|
280
|
+
arraydecl_.dim_decls.each{|dim_decl_| dim_decl_.accept(self,args)}
|
281
|
+
arraydecl_.type.accept(self,args)
|
282
|
+
end
|
283
|
+
|
284
|
+
def visitArrayDimDecl(arraydimdecl_,args=nil)
|
285
|
+
arraydimdecl_.type_mark.accept(self,args)
|
286
|
+
arraydimdecl_.range.accept(self,args)
|
287
|
+
end
|
288
|
+
|
289
|
+
def visitConstant(constant_,args=nil)
|
290
|
+
constant_.name.accept(self,args)
|
291
|
+
constant_.type.accept(self,args)
|
292
|
+
constant_.expr.accept(self,args)
|
293
|
+
end
|
294
|
+
|
295
|
+
def visitSignal(signal_,args=nil)
|
296
|
+
signal_.name.accept(self,args)
|
297
|
+
signal_.type.accept(self,args)
|
298
|
+
signal_.init.accept(self,args)
|
299
|
+
end
|
300
|
+
|
301
|
+
def visitVariable(variable_,args=nil)
|
302
|
+
variable_.name.accept(self,args)
|
303
|
+
variable_.type.accept(self,args)
|
304
|
+
variable_.init.accept(self,args)
|
305
|
+
end
|
306
|
+
|
307
|
+
def visitAlias(alias_,args=nil)
|
308
|
+
alias_.designator.accept(self,args)
|
309
|
+
alias_.type.accept(self,args)
|
310
|
+
alias_.name.accept(self,args)
|
311
|
+
alias_.signature.accept(self,args)
|
312
|
+
end
|
313
|
+
|
314
|
+
def visitStdType(stdtype_,args=nil)
|
315
|
+
stdtype_.ident.accept(self,args)
|
316
|
+
end
|
317
|
+
|
318
|
+
def visitRangedType(rangedtype_,args=nil)
|
319
|
+
rangedtype_.type.accept(self,args)
|
320
|
+
rangedtype_.range.accept(self,args)
|
321
|
+
end
|
322
|
+
|
323
|
+
def visitNamedType(namedtype_,args=nil)
|
324
|
+
namedtype_.ident.accept(self,args)
|
325
|
+
end
|
326
|
+
|
327
|
+
def visitArrayType(arraytype_,args=nil)
|
328
|
+
arraytype_.name.accept(self,args)
|
329
|
+
arraytype_.discrete_ranges.each{|discrete_range_| discrete_range_.accept(self,args)}
|
330
|
+
end
|
331
|
+
|
332
|
+
def visitDiscreteRange(discreterange_,args=nil)
|
333
|
+
discreterange_.lhs.accept(self,args)
|
334
|
+
discreterange_.dir.accept(self,args)
|
335
|
+
discreterange_.rhs.accept(self,args)
|
336
|
+
end
|
337
|
+
|
338
|
+
def visitParenth(parenth_,args=nil)
|
339
|
+
parenth_.expr.accept(self,args)
|
340
|
+
end
|
341
|
+
|
342
|
+
def visitWaveform(waveform_,args=nil)
|
343
|
+
waveform_.elements.each{|element_| element_.accept(self,args)}
|
344
|
+
end
|
345
|
+
|
346
|
+
def visitCondExpr(condexpr_,args=nil)
|
347
|
+
condexpr_.whens.each{|when_| when_.accept(self,args)}
|
348
|
+
condexpr_.else_.accept(self,args)
|
349
|
+
end
|
350
|
+
|
351
|
+
def visitWhen(when_,args=nil)
|
352
|
+
when_.expr.accept(self,args)
|
353
|
+
when_.cond.accept(self,args)
|
354
|
+
end
|
355
|
+
|
356
|
+
def visitBinary(binary_,args=nil)
|
357
|
+
binary_.lhs.accept(self,args)
|
358
|
+
binary_.op.accept(self,args)
|
359
|
+
binary_.rhs.accept(self,args)
|
360
|
+
end
|
361
|
+
|
362
|
+
def visitAfter(after_,args=nil)
|
363
|
+
after_.lhs.accept(self,args)
|
364
|
+
after_.rhs.accept(self,args)
|
365
|
+
end
|
366
|
+
|
367
|
+
def visitTimed(timed_,args=nil)
|
368
|
+
timed_.lhs.accept(self,args)
|
369
|
+
timed_.rhs.accept(self,args)
|
370
|
+
end
|
371
|
+
|
372
|
+
def visitAttributed(attributed_,args=nil)
|
373
|
+
attributed_.lhs.accept(self,args)
|
374
|
+
attributed_.rhs.accept(self,args)
|
375
|
+
end
|
376
|
+
|
377
|
+
def visitConcat(concat_,args=nil)
|
378
|
+
concat_.lhs.accept(self,args)
|
379
|
+
concat_.rhs.accept(self,args)
|
380
|
+
end
|
381
|
+
|
382
|
+
def visitQualified(qualified_,args=nil)
|
383
|
+
qualified_.lhs.accept(self,args)
|
384
|
+
qualified_.rhs.accept(self,args)
|
385
|
+
end
|
386
|
+
|
387
|
+
def visitSliced(sliced_,args=nil)
|
388
|
+
sliced_.expr.accept(self,args)
|
389
|
+
sliced_.lhs.accept(self,args)
|
390
|
+
sliced_.dir.accept(self,args)
|
391
|
+
sliced_.rhs.accept(self,args)
|
392
|
+
end
|
393
|
+
|
394
|
+
def visitIdent(ident_,args=nil)
|
395
|
+
ident_.tok.accept(self,args)
|
396
|
+
end
|
397
|
+
|
398
|
+
def visitIntLit(intlit_,args=nil)
|
399
|
+
intlit_.tok.accept(self,args)
|
400
|
+
end
|
401
|
+
|
402
|
+
def visitCharLit(charlit_,args=nil)
|
403
|
+
charlit_.tok.accept(self,args)
|
404
|
+
end
|
405
|
+
|
406
|
+
def visitBoolLit(boollit_,args=nil)
|
407
|
+
boollit_.tok.accept(self,args)
|
408
|
+
end
|
409
|
+
|
410
|
+
def visitSelectedName(selectedname_,args=nil)
|
411
|
+
selectedname_.lhs.accept(self,args)
|
412
|
+
selectedname_.rhs.accept(self,args)
|
413
|
+
end
|
414
|
+
|
415
|
+
def visitFuncProtoDecl(funcprotodecl_,args=nil)
|
416
|
+
funcprotodecl_.name.accept(self,args)
|
417
|
+
funcprotodecl_.formal_args.each{|formal_arg_| formal_arg_.accept(self,args)}
|
418
|
+
funcprotodecl_.return_type.accept(self,args)
|
419
|
+
end
|
420
|
+
|
421
|
+
def visitFuncDecl(funcdecl_,args=nil)
|
422
|
+
funcdecl_.name.accept(self,args)
|
423
|
+
funcdecl_.formal_args.each{|formal_arg_| formal_arg_.accept(self,args)}
|
424
|
+
funcdecl_.return_type.accept(self,args)
|
425
|
+
funcdecl_.decls.accept(self,args)
|
426
|
+
funcdecl_.body.accept(self,args)
|
427
|
+
end
|
428
|
+
|
429
|
+
def visitFuncCall(funccall_,args=nil)
|
430
|
+
funccall_.name.accept(self,args)
|
431
|
+
funccall_.actual_args.each{|actual_arg_| actual_arg_.accept(self,args)}
|
432
|
+
end
|
433
|
+
|
434
|
+
def visitAggregate(aggregate_,args=nil)
|
435
|
+
aggregate_.elements.each{|element_| element_.accept(self,args)}
|
436
|
+
end
|
437
|
+
|
438
|
+
def visitLabel(label_,args=nil)
|
439
|
+
label_.ident.accept(self,args)
|
440
|
+
end
|
441
|
+
|
442
|
+
def visitAssoc(assoc_,args=nil)
|
443
|
+
assoc_.lhs.accept(self,args)
|
444
|
+
assoc_.rhs.accept(self,args)
|
445
|
+
end
|
446
|
+
end # visitor
|
447
|
+
end # Vertigo
|
@@ -0,0 +1,98 @@
|
|
1
|
+
library ieee;
|
2
|
+
use ieee.std_logic_1164.all;
|
3
|
+
use ieee.numeric_std.all;
|
4
|
+
|
5
|
+
entity fsm is
|
6
|
+
port (
|
7
|
+
reset_n : in std_logic;
|
8
|
+
clk : in std_logic;
|
9
|
+
switches : in std_logic_vector(7 downto 0);
|
10
|
+
leds : out std_logic_vector(7 downto 0);
|
11
|
+
o1,o2 : out std_logic;
|
12
|
+
o3 : out unsigned(3 downto 0)
|
13
|
+
);
|
14
|
+
end entity;
|
15
|
+
|
16
|
+
architecture arch of fsm is
|
17
|
+
type state_t is (S0,S1,S2,S3,S4,S5,S6,S7);
|
18
|
+
signal state,state_c : state_t;
|
19
|
+
|
20
|
+
signal c3 : unsigned(3 downto 0);
|
21
|
+
begin
|
22
|
+
tick :process(reset_n,clk)
|
23
|
+
begin
|
24
|
+
if reset_n='0' then
|
25
|
+
state <= S0;
|
26
|
+
elsif rising_edge(clk) then
|
27
|
+
state <= state_c;
|
28
|
+
end if;
|
29
|
+
end process;
|
30
|
+
|
31
|
+
next_state_logic:process(switches)
|
32
|
+
variable state_v : state_t;
|
33
|
+
begin
|
34
|
+
state_v:= state;
|
35
|
+
o1 <= '0';
|
36
|
+
o2 <= '1';
|
37
|
+
case state_v is
|
38
|
+
when S0 =>
|
39
|
+
if switches(0)='1' then
|
40
|
+
state_v := S1;
|
41
|
+
end if;
|
42
|
+
when S1 =>
|
43
|
+
if switches(1)='1' then
|
44
|
+
state_v := S2;
|
45
|
+
end if;
|
46
|
+
when S2 =>
|
47
|
+
if switches(2)='1' then
|
48
|
+
state_v := S3;
|
49
|
+
end if;
|
50
|
+
when S3 =>
|
51
|
+
if switches(3)='1' then
|
52
|
+
state_v := S4;
|
53
|
+
end if;
|
54
|
+
when S4 =>
|
55
|
+
if switches(4)='1' then
|
56
|
+
state_v := S5;
|
57
|
+
end if;
|
58
|
+
when S5 =>
|
59
|
+
if switches(5)='1' then
|
60
|
+
state_v := S6;
|
61
|
+
o1 <= '1';
|
62
|
+
end if;
|
63
|
+
when S6 =>
|
64
|
+
if switches(6)='1' then
|
65
|
+
state_v := S7;
|
66
|
+
o2 <= '1';
|
67
|
+
end if;
|
68
|
+
when S7 =>
|
69
|
+
if switches(7)='1' then
|
70
|
+
state_v := S0;
|
71
|
+
end if;
|
72
|
+
when others =>
|
73
|
+
null;
|
74
|
+
end case;
|
75
|
+
state_c <= state_v;
|
76
|
+
end process;
|
77
|
+
|
78
|
+
-- single output
|
79
|
+
leds <= std_logic_vector(to_unsigned(0,8)) when state=S0 else
|
80
|
+
std_logic_vector(to_unsigned(1,8)) when state=S1 else
|
81
|
+
std_logic_vector(to_unsigned(2,8)) when state=S2 else
|
82
|
+
std_logic_vector(to_unsigned(3,8)) when state=S3 else
|
83
|
+
std_logic_vector(to_unsigned(4,8)) when state=S4 else
|
84
|
+
std_logic_vector(to_unsigned(5,8)) when state=S5 else
|
85
|
+
std_logic_vector(to_unsigned(6,8)) when state=S6 else
|
86
|
+
std_logic_vector(to_unsigned(7,8));
|
87
|
+
|
88
|
+
process(reset_n,clk)
|
89
|
+
begin
|
90
|
+
if reset_n='0' then
|
91
|
+
c3 <= to_unsigned(0,4);
|
92
|
+
elsif rising_edge(clk) then
|
93
|
+
c3 <= c3 + 1;
|
94
|
+
end if;
|
95
|
+
end process;
|
96
|
+
o3 <= c3;
|
97
|
+
|
98
|
+
end architecture;
|