|
@@ -6,7 +6,7 @@ const tScaled = (msg::Int) -> Int(floor(sqrt(msg) * 2))
|
|
|
const translation_table = Dict(i => i + 100 for i in 0:1000)
|
|
const translation_table = Dict(i => i + 100 for i in 0:1000)
|
|
|
const tAccessed = (msg::Int) -> (get(translation_table, msg % 1000, msg))
|
|
const tAccessed = (msg::Int) -> (get(translation_table, msg % 1000, msg))
|
|
|
|
|
|
|
|
-global active_z_function = tScaled
|
|
|
|
|
|
|
+global active_z_function = tIdentity
|
|
|
|
|
|
|
|
# Port Config
|
|
# Port Config
|
|
|
function setup_ports!(top_model::CoupledDEVS, type::Structure)
|
|
function setup_ports!(top_model::CoupledDEVS, type::Structure)
|
|
@@ -37,9 +37,9 @@ function build_leaf_node(name::String, type::Structure, int_delay::Float64, ext_
|
|
|
int_delay=int_delay, ext_delay=ext_delay, prep_time=p_time,
|
|
int_delay=int_delay, ext_delay=ext_delay, prep_time=p_time,
|
|
|
has_out_port=has_out_port, stats=stats)
|
|
has_out_port=has_out_port, stats=stats)
|
|
|
|
|
|
|
|
- connect!(top_model, self.i_in, atom.i_in; Z=active_z_function)
|
|
|
|
|
|
|
+ connect!(top_model, self.i_in, atom.i_in)
|
|
|
if has_out_port
|
|
if has_out_port
|
|
|
- connect!(top_model, atom.o_out, self.o_out; Z=active_z_function)
|
|
|
|
|
|
|
+ connect!(top_model, atom.o_out, self.o_out)
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
return top_model
|
|
return top_model
|
|
@@ -66,16 +66,16 @@ end
|
|
|
# Routing
|
|
# Routing
|
|
|
function route_LI!(top_model::CoupledDEVS, width_models::Vector{ModelRef})
|
|
function route_LI!(top_model::CoupledDEVS, width_models::Vector{ModelRef})
|
|
|
for atom in width_models
|
|
for atom in width_models
|
|
|
- connect!(top_model, self.i_in, atom.i_in; Z=active_z_function)
|
|
|
|
|
|
|
+ connect!(top_model, self.i_in, atom.i_in)
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
function route_HI!(top_model::CoupledDEVS, width_models::Vector{ModelRef})
|
|
function route_HI!(top_model::CoupledDEVS, width_models::Vector{ModelRef})
|
|
|
for atom in width_models
|
|
for atom in width_models
|
|
|
- connect!(top_model, self.i_in, atom.i_in; Z=active_z_function)
|
|
|
|
|
|
|
+ connect!(top_model, self.i_in, atom.i_in)
|
|
|
end
|
|
end
|
|
|
for i in 1:(length(width_models) - 1)
|
|
for i in 1:(length(width_models) - 1)
|
|
|
- connect!(top_model, width_models[i].o_out, width_models[i + 1].i_in; Z=active_z_function)
|
|
|
|
|
|
|
+ connect!(top_model, width_models[i].o_out, width_models[i + 1].i_in)
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
|
|
|
|
@@ -84,15 +84,15 @@ function route_HO!(top_model::CoupledDEVS, width_models::Vector{ModelRef})
|
|
|
curr_atom = width_models[i]
|
|
curr_atom = width_models[i]
|
|
|
next_atom = width_models[i + 1]
|
|
next_atom = width_models[i + 1]
|
|
|
|
|
|
|
|
- connect!(top_model, curr_atom.o_out, next_atom.i_in; Z=active_z_function)
|
|
|
|
|
- connect!(top_model, self.i_in2, curr_atom.i_in; Z=active_z_function)
|
|
|
|
|
- connect!(top_model, curr_atom.o_out, self.o_out2; Z=active_z_function)
|
|
|
|
|
|
|
+ connect!(top_model, curr_atom.o_out, next_atom.i_in)
|
|
|
|
|
+ connect!(top_model, self.i_in2, curr_atom.i_in)
|
|
|
|
|
+ connect!(top_model, curr_atom.o_out, self.o_out2)
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
if !isempty(width_models)
|
|
if !isempty(width_models)
|
|
|
last_atom = width_models[end]
|
|
last_atom = width_models[end]
|
|
|
- connect!(top_model, self.i_in2, last_atom.i_in; Z=active_z_function)
|
|
|
|
|
- connect!(top_model, last_atom.o_out, self.o_out2; Z=active_z_function)
|
|
|
|
|
|
|
+ connect!(top_model, self.i_in2, last_atom.i_in)
|
|
|
|
|
+ connect!(top_model, last_atom.o_out, self.o_out2)
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
|
|
|
|
@@ -123,29 +123,29 @@ function build_HOmod!(top_model::CoupledDEVS, child::ModelRef, depth::Int, width
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
for atom in atomics[0]
|
|
for atom in atomics[0]
|
|
|
- connect!(top_model, self.i_in2, atom.i_in; Z=active_z_function)
|
|
|
|
|
|
|
+ connect!(top_model, self.i_in2, atom.i_in)
|
|
|
end
|
|
end
|
|
|
for i in 1:(width - 1)
|
|
for i in 1:(width - 1)
|
|
|
if !isempty(atomics[i])
|
|
if !isempty(atomics[i])
|
|
|
- connect!(top_model, self.i_in2, atomics[i][1].i_in; Z=active_z_function)
|
|
|
|
|
|
|
+ connect!(top_model, self.i_in2, atomics[i][1].i_in)
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
for atom in atomics[0]
|
|
for atom in atomics[0]
|
|
|
- connect!(top_model, atom.o_out, child.i_in2; Z=active_z_function)
|
|
|
|
|
|
|
+ connect!(top_model, atom.o_out, child.i_in2)
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
if haskey(atomics, 1) && haskey(atomics, 0)
|
|
if haskey(atomics, 1) && haskey(atomics, 0)
|
|
|
for atom1 in atomics[1]
|
|
for atom1 in atomics[1]
|
|
|
for atom0 in atomics[0]
|
|
for atom0 in atomics[0]
|
|
|
- connect!(top_model, atom1.o_out, atom0.i_in; Z=active_z_function)
|
|
|
|
|
|
|
+ connect!(top_model, atom1.o_out, atom0.i_in)
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
for i in 2:(width - 1)
|
|
for i in 2:(width - 1)
|
|
|
for j in 1:length(atomics[i])
|
|
for j in 1:length(atomics[i])
|
|
|
- connect!(top_model, atomics[i][j].o_out, atomics[i-1][j+1].i_in; Z=active_z_function)
|
|
|
|
|
|
|
+ connect!(top_model, atomics[i][j].o_out, atomics[i-1][j+1].i_in)
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
@@ -170,12 +170,12 @@ function build_devstone(type::Structure, name::String, depth::Int, width::Int, i
|
|
|
child = add_submodel!(top_model, coupled_name, child_coupled)
|
|
child = add_submodel!(top_model, coupled_name, child_coupled)
|
|
|
|
|
|
|
|
# Connect Parent to Child
|
|
# Connect Parent to Child
|
|
|
- connect!(top_model, self.i_in, child.i_in; Z=active_z_function)
|
|
|
|
|
|
|
+ connect!(top_model, self.i_in, child.i_in)
|
|
|
if type == HO
|
|
if type == HO
|
|
|
- connect!(top_model, self.i_in, child.i_in2; Z=active_z_function)
|
|
|
|
|
|
|
+ connect!(top_model, self.i_in, child.i_in2)
|
|
|
end
|
|
end
|
|
|
if has_out_port
|
|
if has_out_port
|
|
|
- connect!(top_model, child.o_out, self.o_out; Z=active_z_function)
|
|
|
|
|
|
|
+ connect!(top_model, child.o_out, self.o_out)
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
# Sub-topology Generation & Routing
|
|
# Sub-topology Generation & Routing
|