@@ -9,8 +9,13 @@ use xml::attribute::OwnedAttribute;
99use crate :: parse_error:: * ;
1010use crate :: arch:: * ;
1111
12- use crate :: parse_port;
12+ use crate :: parse_port:: parse_port ;
1313use crate :: parse_metadata:: parse_metadata;
14+ use crate :: parse_timing:: parse_delay_constant;
15+ use crate :: parse_timing:: parse_delay_matrix;
16+ use crate :: parse_timing:: parse_t_setup;
17+ use crate :: parse_timing:: parse_t_hold;
18+ use crate :: parse_timing:: parse_clock_to_q;
1419
1520fn parse_pack_pattern ( name : & OwnedName ,
1621 attributes : & [ OwnedAttribute ] ,
@@ -131,6 +136,7 @@ fn parse_interconnect(name: &OwnedName,
131136 } ;
132137
133138 let mut pack_patterns: Vec < PackPattern > = Vec :: new ( ) ;
139+ let mut delays: Vec < DelayInfo > = Vec :: new ( ) ;
134140 let mut metadata: Option < Vec < Metadata > > = None ;
135141 loop {
136142 match parser. next ( ) {
@@ -140,14 +146,10 @@ fn parse_interconnect(name: &OwnedName,
140146 pack_patterns. push ( parse_pack_pattern ( & name, & attributes, parser) ?) ;
141147 } ,
142148 "delay_constant" => {
143- // TODO: Implement.
144- // FIXME: Check that this is documented in VTR.
145- let _ = parser. skip ( ) ;
149+ delays. push ( parse_delay_constant ( & name, & attributes, parser) ?) ;
146150 } ,
147151 "delay_matrix" => {
148- // TODO: Implement.
149- // FIXME: Check that this is documented in VTR.
150- let _ = parser. skip ( ) ;
152+ delays. push ( parse_delay_matrix ( & name, & attributes, parser) ?) ;
151153 } ,
152154 "metadata" => {
153155 metadata = match metadata {
@@ -180,20 +182,23 @@ fn parse_interconnect(name: &OwnedName,
180182 input,
181183 output,
182184 pack_patterns,
185+ delays,
183186 metadata,
184187 } ) ) ,
185188 "mux" => Ok ( Interconnect :: Mux ( MuxInterconnect {
186189 name : inter_name,
187190 input,
188191 output,
189192 pack_patterns,
193+ delays,
190194 metadata,
191195 } ) ) ,
192196 "complete" => Ok ( Interconnect :: Complete ( CompleteInterconnect {
193197 name : inter_name,
194198 input,
195199 output,
196200 pack_patterns,
201+ delays,
197202 metadata,
198203 } ) ) ,
199204 _ => Err ( FPGAArchParseError :: InvalidTag ( format ! ( "Unknown interconnect tag: {name}" ) , parser. position ( ) ) ) ,
@@ -376,6 +381,8 @@ fn parse_pb_type(name: &OwnedName,
376381 let mut pb_types: Vec < PBType > = Vec :: new ( ) ;
377382 let mut pb_modes: Vec < PBMode > = Vec :: new ( ) ;
378383 let mut interconnects: Option < Vec < Interconnect > > = None ;
384+ let mut delays: Vec < DelayInfo > = Vec :: new ( ) ;
385+ let mut timing_constraints: Vec < TimingConstraintInfo > = Vec :: new ( ) ;
379386 let mut metadata: Option < Vec < Metadata > > = None ;
380387 loop {
381388 match parser. next ( ) {
@@ -402,29 +409,19 @@ fn parse_pb_type(name: &OwnedName,
402409 let _ = parser. skip ( ) ;
403410 } ,
404411 "delay_constant" => {
405- // TODO: Implement.
406- // FIXME: Check that this is documented in VTR.
407- let _ = parser. skip ( ) ;
412+ delays. push ( parse_delay_constant ( & name, & attributes, parser) ?) ;
408413 } ,
409414 "delay_matrix" => {
410- // TODO: Implement.
411- // FIXME: Check that this is documented in VTR.
412- let _ = parser. skip ( ) ;
415+ delays. push ( parse_delay_matrix ( & name, & attributes, parser) ?) ;
413416 } ,
414417 "T_setup" => {
415- // TODO: Implement.
416- // FIXME: Check that this is documented in VTR.
417- let _ = parser. skip ( ) ;
418+ timing_constraints. push ( parse_t_setup ( & name, & attributes, parser) ?) ;
418419 } ,
419420 "T_hold" => {
420- // TODO: Implement.
421- // FIXME: Check that this is documented in VTR.
422- let _ = parser. skip ( ) ;
421+ timing_constraints. push ( parse_t_hold ( & name, & attributes, parser) ?) ;
423422 } ,
424423 "T_clock_to_Q" => {
425- // TODO: Implement.
426- // FIXME: Check that this is documented in VTR.
427- let _ = parser. skip ( ) ;
424+ timing_constraints. push ( parse_clock_to_q ( & name, & attributes, parser) ?) ;
428425 } ,
429426 "metadata" => {
430427 metadata = match metadata {
@@ -473,6 +470,8 @@ fn parse_pb_type(name: &OwnedName,
473470 modes : pb_modes,
474471 pb_types,
475472 interconnects,
473+ delays,
474+ timing_constraints,
476475 metadata,
477476 } )
478477}
0 commit comments