code: def encrypt_state_m(self, plaintext_in, key_in, reset):
          
          if len(key_in) != len(plaintext_in):
              raise pyrtl.PyrtlError("AES key and plaintext should be the same length")
  
          plain_text, key = (pyrtl.Register(len(plaintext_in)) for i in range(2))
          key_exp_in, add_round_in = (pyrtl.WireVector(len(plaintext_in)) for i in range(2))
  
          counter = pyrtl.Register(4, 'counter')
          round = pyrtl.WireVector(4, 'round')
          counter.next <<= round
          sub_out = self._sub_bytes(plain_text)
          shift_out = self._shift_rows(sub_out)
          mix_out = self._mix_columns(shift_out)
          key_out = self._key_expansion(key, counter)
          add_round_out = self._add_round_key(add_round_in, key_exp_in)
          with pyrtl.conditional_assignment:
              with reset == 1:
                  round |= 0
                  key_exp_in |= key_in  # to lower the number of cycles
                  plain_text.next |= add_round_out
                  key.next |= key_in
                  add_round_in |= plaintext_in
  
              with counter == 10:  # keep everything the same
                  round |= counter
                  plain_text.next |= plain_text
  
              with pyrtl.otherwise:  # running through AES
                  round |= counter + 1
                  key_exp_in |= key_out
                  plain_text.next |= add_round_out
                  key.next |= key_out
                  with counter == 9:
                      add_round_in |= shift_out
                  with pyrtl.otherwise:
                      add_round_in |= mix_out
  
          ready = (counter == 10)
          return ready, plain_text
docs: Builds a multiple cycle AES Encryption state machine circuit
  
          :param reset: a one bit signal telling the state machine
            to reset and accept the current plaintext and key
          :return ready, cipher_text: ready is a one bit signal showing
            that the encryption result (cipher_text) has been calculated.