|
|
|
@ -88,10 +88,7 @@ pub fn route(module: Module) -> Result<(Vec<lw::Component>, Vec<lw::Wire>), Erro
|
|
|
|
|
&mut connection_map,
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
// align back to middle
|
|
|
|
|
next_input_position[0] += SQUARE/2;
|
|
|
|
|
next_input_position[0] -= next_input_position[0] % SQUARE;
|
|
|
|
|
next_input_position[0] += SQUARE/2;
|
|
|
|
|
next_input_position[0] += SQUARE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let mut next_position = vec3_add(origin, [1 * SQUARE, 0, 3 * SQUARE]);
|
|
|
|
@ -140,10 +137,7 @@ pub fn route(module: Module) -> Result<(Vec<lw::Component>, Vec<lw::Wire>), Erro
|
|
|
|
|
&mut connection_map,
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
// align back to middle
|
|
|
|
|
next_output_position[0] += SQUARE/2;
|
|
|
|
|
next_output_position[0] -= next_output_position[0] % SQUARE;
|
|
|
|
|
next_output_position[0] += SQUARE/2;
|
|
|
|
|
next_output_position[0] += SQUARE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let board = lw::Component {
|
|
|
|
@ -205,33 +199,33 @@ fn input_port(
|
|
|
|
|
next_position: &mut Vector3<lw::Int>,
|
|
|
|
|
connection_map: &mut HashMap<(usize, &str), lw::PegAddress>,
|
|
|
|
|
) -> Vec<lw::Component> {
|
|
|
|
|
|
|
|
|
|
let label = lw::Component {
|
|
|
|
|
let peg = lw::Component {
|
|
|
|
|
address: *next_address,
|
|
|
|
|
parent: parent_address,
|
|
|
|
|
numeric_id: COMPONENT_MAP["MHG.PanelLabel"],
|
|
|
|
|
numeric_id: COMPONENT_MAP["MHG.Peg"],
|
|
|
|
|
position: *next_position,
|
|
|
|
|
rotation: quaternion::euler_angles(0.0, -PI / 2.0, 0.0),
|
|
|
|
|
inputs: vec![],
|
|
|
|
|
rotation: quaternion::id(),
|
|
|
|
|
inputs: vec![lw::Input::new(bit_id as lw::Int)],
|
|
|
|
|
outputs: vec![],
|
|
|
|
|
custom_data: lw::Label::new(port_name).with_size(2.0).custom_data(),
|
|
|
|
|
custom_data: vec![],
|
|
|
|
|
};
|
|
|
|
|
connection_map.insert((bit_id, "input"), lw::PegAddress::input(peg.address, 0));
|
|
|
|
|
|
|
|
|
|
*next_address += 1;
|
|
|
|
|
|
|
|
|
|
let peg = lw::Component {
|
|
|
|
|
let label = lw::Component {
|
|
|
|
|
address: *next_address,
|
|
|
|
|
parent: parent_address,
|
|
|
|
|
numeric_id: COMPONENT_MAP["MHG.Peg"],
|
|
|
|
|
numeric_id: COMPONENT_MAP["MHG.PanelLabel"],
|
|
|
|
|
position: vec3_add(*next_position, [0, 0, SQUARE]),
|
|
|
|
|
rotation: quaternion::id(),
|
|
|
|
|
inputs: vec![lw::Input::new(bit_id as lw::Int)],
|
|
|
|
|
rotation: quaternion::euler_angles(0.0, -PI / 2.0, 0.0),
|
|
|
|
|
inputs: vec![],
|
|
|
|
|
outputs: vec![],
|
|
|
|
|
custom_data: vec![],
|
|
|
|
|
custom_data: lw::Label::new(port_name).with_size(2.0).custom_data(),
|
|
|
|
|
};
|
|
|
|
|
connection_map.insert((bit_id, "input"), lw::PegAddress::input(peg.address, 0));
|
|
|
|
|
|
|
|
|
|
*next_address += 1;
|
|
|
|
|
|
|
|
|
|
next_position[0] += SQUARE / 3; // third of a square
|
|
|
|
|
|
|
|
|
|
return vec![peg, label];
|
|
|
|
@ -245,33 +239,34 @@ fn output_port(
|
|
|
|
|
next_position: &mut Vector3<lw::Int>,
|
|
|
|
|
connection_map: &mut HashMap<(usize, &str), lw::PegAddress>,
|
|
|
|
|
) -> Vec<lw::Component> {
|
|
|
|
|
|
|
|
|
|
let label = lw::Component {
|
|
|
|
|
let peg = lw::Component {
|
|
|
|
|
address: *next_address,
|
|
|
|
|
parent: parent_address,
|
|
|
|
|
numeric_id: COMPONENT_MAP["MHG.PanelLabel"],
|
|
|
|
|
numeric_id: COMPONENT_MAP["MHG.Peg"],
|
|
|
|
|
position: vec3_add(*next_position, [0, 0, SQUARE]),
|
|
|
|
|
rotation: quaternion::euler_angles(0.0, -PI / 2.0, 0.0),
|
|
|
|
|
inputs: vec![],
|
|
|
|
|
rotation: quaternion::id(),
|
|
|
|
|
inputs: vec![lw::Input::new(bit_id as lw::Int)],
|
|
|
|
|
outputs: vec![],
|
|
|
|
|
custom_data: lw::Label::new(port_name).with_size(2.0).custom_data(),
|
|
|
|
|
custom_data: vec![],
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
connection_map.insert((bit_id, "output"), lw::PegAddress::input(peg.address, 0));
|
|
|
|
|
|
|
|
|
|
*next_address += 1;
|
|
|
|
|
|
|
|
|
|
let peg = lw::Component {
|
|
|
|
|
let label = lw::Component {
|
|
|
|
|
address: *next_address,
|
|
|
|
|
parent: parent_address,
|
|
|
|
|
numeric_id: COMPONENT_MAP["MHG.Peg"],
|
|
|
|
|
numeric_id: COMPONENT_MAP["MHG.PanelLabel"],
|
|
|
|
|
position: *next_position,
|
|
|
|
|
rotation: quaternion::id(),
|
|
|
|
|
inputs: vec![lw::Input::new(bit_id as lw::Int)],
|
|
|
|
|
rotation: quaternion::euler_angles(0.0, -PI / 2.0, 0.0),
|
|
|
|
|
inputs: vec![],
|
|
|
|
|
outputs: vec![],
|
|
|
|
|
custom_data: vec![],
|
|
|
|
|
custom_data: lw::Label::new(port_name).with_size(2.0).custom_data(),
|
|
|
|
|
};
|
|
|
|
|
connection_map.insert((bit_id, "output"), lw::PegAddress::input(peg.address, 0));
|
|
|
|
|
|
|
|
|
|
*next_address += 1;
|
|
|
|
|
|
|
|
|
|
next_position[0] += SQUARE / 3; // third of a square
|
|
|
|
|
|
|
|
|
|
return vec![peg, label];
|
|
|
|
|