Compare commits
	
		
			2 commits
		
	
	
		
			6b31e6d515
			...
			8616ee4737
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 8616ee4737 | |||
| 5087f16099 | 
					 4 changed files with 1760 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -458,6 +458,9 @@ impl Assignments {
 | 
			
		|||
            slot_readers
 | 
			
		||||
                .keys_for_assignment(assignment_index)
 | 
			
		||||
                .extend([&assignment.inputs]);
 | 
			
		||||
            slot_readers
 | 
			
		||||
                .keys_for_assignment(assignment_index)
 | 
			
		||||
                .extend(&assignment.conditions);
 | 
			
		||||
            let SlotSet(TypeParts {
 | 
			
		||||
                small_slots,
 | 
			
		||||
                big_slots,
 | 
			
		||||
| 
						 | 
				
			
			@ -1400,6 +1403,30 @@ impl<'a> Extend<&'a SlotSet> for SlotToAssignmentIndexFullMapKeysForAssignment<'
 | 
			
		|||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl<'a> Extend<&'a Cond> for SlotToAssignmentIndexFullMapKeysForAssignment<'_> {
 | 
			
		||||
    fn extend<T: IntoIterator<Item = &'a Cond>>(&mut self, iter: T) {
 | 
			
		||||
        iter.into_iter().for_each(|cond| match cond.body {
 | 
			
		||||
            CondBody::IfTrue { cond } | CondBody::IfFalse { cond } => {
 | 
			
		||||
                let CompiledValue {
 | 
			
		||||
                    range:
 | 
			
		||||
                        TypeIndexRange {
 | 
			
		||||
                            small_slots,
 | 
			
		||||
                            big_slots,
 | 
			
		||||
                        },
 | 
			
		||||
                    layout: _,
 | 
			
		||||
                    write: _,
 | 
			
		||||
                } = cond;
 | 
			
		||||
                self.extend(small_slots.iter());
 | 
			
		||||
                self.extend(big_slots.iter());
 | 
			
		||||
            }
 | 
			
		||||
            CondBody::MatchArm {
 | 
			
		||||
                discriminant,
 | 
			
		||||
                variant_index: _,
 | 
			
		||||
            } => self.extend([discriminant]),
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl Assignment {
 | 
			
		||||
    fn new(
 | 
			
		||||
        conditions: Interned<[Cond]>,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -363,7 +363,6 @@ pub fn enums() {
 | 
			
		|||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#[cfg(todo)] // FIXME: enum lowering currently broken
 | 
			
		||||
#[hdl]
 | 
			
		||||
#[test]
 | 
			
		||||
fn test_enums() {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							| 
						 | 
				
			
			@ -0,0 +1,94 @@
 | 
			
		|||
$timescale 1 ps $end
 | 
			
		||||
$scope module enums $end
 | 
			
		||||
$scope struct cd $end
 | 
			
		||||
$var wire 1 ! clk $end
 | 
			
		||||
$var wire 1 " rst $end
 | 
			
		||||
$upscope $end
 | 
			
		||||
$var wire 1 # en $end
 | 
			
		||||
$var wire 2 $ which_in $end
 | 
			
		||||
$var wire 4 % data_in $end
 | 
			
		||||
$var wire 2 & which_out $end
 | 
			
		||||
$var wire 4 ' data_out $end
 | 
			
		||||
$scope struct the_reg $end
 | 
			
		||||
$var string 1 ( \$tag $end
 | 
			
		||||
$scope struct B $end
 | 
			
		||||
$var reg 1 ) \0 $end
 | 
			
		||||
$var reg 1 * \1 $end
 | 
			
		||||
$upscope $end
 | 
			
		||||
$scope struct C $end
 | 
			
		||||
$scope struct a $end
 | 
			
		||||
$var reg 1 + \[0] $end
 | 
			
		||||
$var reg 1 , \[1] $end
 | 
			
		||||
$upscope $end
 | 
			
		||||
$var reg 2 - b $end
 | 
			
		||||
$upscope $end
 | 
			
		||||
$upscope $end
 | 
			
		||||
$upscope $end
 | 
			
		||||
$enddefinitions $end
 | 
			
		||||
$dumpvars
 | 
			
		||||
0!
 | 
			
		||||
1"
 | 
			
		||||
0#
 | 
			
		||||
b0 $
 | 
			
		||||
b0 %
 | 
			
		||||
b0 &
 | 
			
		||||
b0 '
 | 
			
		||||
sA\x20(0) (
 | 
			
		||||
0)
 | 
			
		||||
0*
 | 
			
		||||
0+
 | 
			
		||||
0,
 | 
			
		||||
b0 -
 | 
			
		||||
$end
 | 
			
		||||
#1000000
 | 
			
		||||
1!
 | 
			
		||||
#1100000
 | 
			
		||||
0"
 | 
			
		||||
#2000000
 | 
			
		||||
0!
 | 
			
		||||
#3000000
 | 
			
		||||
1!
 | 
			
		||||
#4000000
 | 
			
		||||
1#
 | 
			
		||||
b1 $
 | 
			
		||||
0!
 | 
			
		||||
#5000000
 | 
			
		||||
1!
 | 
			
		||||
b1 &
 | 
			
		||||
sB\x20(1) (
 | 
			
		||||
#6000000
 | 
			
		||||
0#
 | 
			
		||||
b0 $
 | 
			
		||||
0!
 | 
			
		||||
#7000000
 | 
			
		||||
1!
 | 
			
		||||
#8000000
 | 
			
		||||
1#
 | 
			
		||||
b1 $
 | 
			
		||||
b1111 %
 | 
			
		||||
0!
 | 
			
		||||
#9000000
 | 
			
		||||
1!
 | 
			
		||||
b11 '
 | 
			
		||||
1)
 | 
			
		||||
1*
 | 
			
		||||
1+
 | 
			
		||||
1,
 | 
			
		||||
#10000000
 | 
			
		||||
0!
 | 
			
		||||
#11000000
 | 
			
		||||
1!
 | 
			
		||||
#12000000
 | 
			
		||||
b10 $
 | 
			
		||||
0!
 | 
			
		||||
#13000000
 | 
			
		||||
1!
 | 
			
		||||
b10 &
 | 
			
		||||
b1111 '
 | 
			
		||||
sC\x20(2) (
 | 
			
		||||
b11 -
 | 
			
		||||
#14000000
 | 
			
		||||
0!
 | 
			
		||||
#15000000
 | 
			
		||||
1!
 | 
			
		||||
#16000000
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue