That reminds me of a famous incident where a circus elephant named Mary was hanged by the neck until dead for committing murder on a human. She got angry at her human handler for prodding her and stomped him. See https://en.wikipedia.org/wiki/Mary_(elephant) for the details and a pic of Mary's hanging. I don't think she got to defend herself in a court of law, though.
My two cents on the subject is I think the law could accommodate intelligent animals, but each species should probably be treated differently based on their nature and capabilities. I don't think treating them as persons is the right idea.
At the source of every error which is blamed on the computer you will find at least two human errors, including the error of blaming it on the computer.