mirror of
				https://github.com/openhwgroup/cvw
				synced 2025-02-11 06:05:49 +00:00 
			
		
		
		
	update on aes_instructions
This commit is contained in:
		
							parent
							
								
									7097b17785
								
							
						
					
					
						commit
						7cb170c19b
					
				@ -40,16 +40,22 @@ module aes32esi(input logic [1:0] bs,
 | 
			
		||||
    
 | 
			
		||||
   // Shift bs by 3 to get shamt
 | 
			
		||||
   assign shamt = {bs, 3'b0};
 | 
			
		||||
   
 | 
			
		||||
   // Shift rs2 right by shamt to get sbox input
 | 
			
		||||
   assign sbox_in_32 = (rs2 >> shamt);
 | 
			
		||||
   
 | 
			
		||||
   // Take the bottom byte as an input to the substitution box
 | 
			
		||||
   assign sbox_in = sbox_in_32[7:0];
 | 
			
		||||
   
 | 
			
		||||
   // Substitute
 | 
			
		||||
   aes_sbox subbox(.in(sbox_in),.out(sbox_out));
 | 
			
		||||
   
 | 
			
		||||
   // Pad sbox output
 | 
			
		||||
   assign so = {24'h000000,sbox_out};
 | 
			
		||||
   
 | 
			
		||||
   // Rotate so left by shamt
 | 
			
		||||
   rotate_left rol32(.input_data(so),.shamt(shamt),.rot_data(so_rotate));
 | 
			
		||||
   
 | 
			
		||||
   // Set result X(rs1)[31..0] ^ rol32(so, unsigned(shamt));
 | 
			
		||||
   assign data_out = rs1 ^ so_rotate;
 | 
			
		||||
   
 | 
			
		||||
 | 
			
		||||
@ -41,18 +41,25 @@ module aes32esmi(input logic [1:0]   bs,
 | 
			
		||||
   
 | 
			
		||||
   // Shift bs by 3 to get shamt
 | 
			
		||||
   assign shamt = {bs, 3'b0};
 | 
			
		||||
   
 | 
			
		||||
   // Shift rs2 right by shamt to get sbox input
 | 
			
		||||
   assign sbox_in_32 = (rs2 >> shamt);
 | 
			
		||||
   
 | 
			
		||||
   // Take the bottom byte as an input to the substitution box
 | 
			
		||||
   assign sbox_in = sbox_in_32[7:0];
 | 
			
		||||
   
 | 
			
		||||
   // Substitute
 | 
			
		||||
   aes_sbox sbox(.in(sbox_in),.out(sbox_out));
 | 
			
		||||
   
 | 
			
		||||
   // Pad sbox output
 | 
			
		||||
   assign so = {24'h000000,sbox_out};
 | 
			
		||||
   
 | 
			
		||||
   // Mix Word using aes_mixword component
 | 
			
		||||
   mixword mwd(.word(so),.mixed_word(mixed));
 | 
			
		||||
   
 | 
			
		||||
   // Rotate so left by shamt
 | 
			
		||||
   rotate_left rol32(.input_data(mixed),.shamt(shamt),.rot_data(mixed_rotate));
 | 
			
		||||
   
 | 
			
		||||
   // Set result X(rs1)[31..0] ^ rol32(mixed, unsigned(shamt));
 | 
			
		||||
   assign data_out = rs1 ^ mixed_rotate;
 | 
			
		||||
   
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user