From nobody Sun Dec 6 20:46:08 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1796248329; cv=none; d=zohomail.com; s=zohoarc; b=UPdy2n38C/lxbBpjOhpwJ0pagE1KPp3wlnuUABfJAqu6iDailgy/0EqCRjM60IpeFj0sQDmKd4FQ4Go3Sg1IsJ7anDz6i7RoCQXSiHTNfrwh4cSzV7nhstERWGxLvR/7SzROSmQ/EHR5zi5jh7HShwFTGn8JAKnoJVuvZ/Xukto= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1796248329; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=AaLTZYIX5fXtFvrcx48DETa7WHhXSWSpygwClIQaYco=; b=kI+Vuz5Om30HPXB72tBNykPt5TZGFZjDwHcokPCRuyyMXMxCFMuRLZgLGo3GtMNWJXGa/0VbmXTYzkB+ol6ghJzj2OBk3wRBXvSddrPVXgqf1Qs+Xvj91i+1WOnqBcJ+44YayBRcxzInvGS9PBHwKGH1E5+9CZkApUDOg7lhC7I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17962483296901007.3650178269146; Wed, 2 Dec 2026 13:52:09 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xYsF7-0005o3-3H; Wed, 02 Dec 2026 16:52:01 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xYsF2-0005lz-MO for qemu-devel@nongnu.org; Wed, 02 Dec 2026 16:51:56 -0500 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xYsF0-0001xz-TZ for qemu-devel@nongnu.org; Wed, 02 Dec 2026 16:51:56 -0500 Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6B2LGtHi1854414 for ; Wed, 2 Dec 2026 21:51:53 GMT Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4jahwjtj52-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 02 Dec 2026 21:51:53 +0000 (GMT) Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-93f33438950so2286875085a.1 for ; Wed, 02 Dec 2026 13:51:53 -0800 (PST) Received: from localhost.localdomain (pmd666.hd.free.fr. [82.67.153.177]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bbdff53b41sm20720025e9.0.2026.12.02.13.51.50 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 02 Dec 2026 13:51:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=qcppdkim1; bh=AaLTZYIX5fXtFvrcx48DET a7WHhXSWSpygwClIQaYco=; b=gY+CIn84iVkOLZoa6rciEE+C6rAEF3RT5Vngok Vr6s1isutKqTv2e4606SVDXzPp+ndF80EoA/ow9+A1tmRV959rKvMlotK3tDpmnh OzcYzOWtWuOisqrVxRTFqsKkrBv+DXpnM8tPqqoHQnG1umPWOUhEHshqKcVlNqmL RUIdk9/qczPB8LhJyq0ZKd84NRoauKjw2sZ+5ec2DFZyZJfnmMpOVRyAg/SvHFM1 Bwv6StSjWnBNZKMSOfGZRl4U2hxWinSWNaqQUrRBDc4amfDUAxvzqs+cgIEPjDLR LVUlJ0apNR+99IaI3zLNMyntuTblsi1CAqTncCp7AUntpfXQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1796248312; x=1796853112; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:message-id:date :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to :content-type; bh=AaLTZYIX5fXtFvrcx48DETa7WHhXSWSpygwClIQaYco=; b=fsmWxZXMnFB76ywPk5SiEfqn4QwAiRZWuBmJmbwHKlLE5lSZzt491aTfJ/ACfqpGkB kmkODsUd9F2ZpE2msTxvssQRjLqukGSwJnJbkhkI0GWlucy10d3hA6DktMaGnH/FcC7Y heI1Qg/IOAtBHC0kHeLYFp1eFIC3iIQ/fAiY+ekFqFxt+lacvAAoEQODL6oWDN8fnn8d IkqMfkj3lmPO6KdpL5kTOTdPqGgO2DXkhS+bc9ISTidkeXVsHPaROyJhlSS/lKRngrn4 lz0uyaY0L2fepf/BH1CemaqtKv5T2bRsel2OhgPhul9sIdOKmOgqLElZC/bpyXYyyvIl Uw6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796248312; x=1796853112; h=content-transfer-encoding:content-type:mime-version:message-id:date :subject:cc:to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to:content-type; bh=AaLTZYIX5fXtFvrcx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:a05:620a:6e9c:10b0:94a:531c:6905 with SMTP id af79cd13be357-94a531c6a06mr1134472385a.44.1796248312107; Wed, 02 Dec 2026 13:51:52 -0800 (PST) X-Received: by 2002:a05:620a:6e9c:10b0:94a:531c:6905 with SMTP id af79cd13be357-94a531c6a06mr1134468585a.44.1796248311368; Wed, 02 Dec 2026 13:51:51 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH RISU] risugen: Add --seed option Date: Wed, 2 Dec 2026 22:51:49 +0100 Message-ID: <20261202215149.44309-1-philmd@oss.qualcomm.com> X-Mailer: git-send-email 2.55.0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: YRU22fpwVjZXmtKrhRjR-dEpj9woDyMP X-Proofpoint-Spam-Info: AW1haW4tMjYxMjAyMDA4NyBTYWx0ZWRfX02a/RE5jx7SE G1ChB61o945MflOtaqwygSDgNdyUq/tVdalCwZHIS5A2tobkDE91uMguz6EPn7MxAK2yaEVOWEu ga2C1Kn7HgvdTYgVwNxYTOS07tbI200= X-Proofpoint-GUID: YRU22fpwVjZXmtKrhRjR-dEpj9woDyMP X-Authority-Analysis: v=2.4 cv=JLuuIMKb c=1 sm=1 tr=0 ts=6b1092f9 cx=c_pps a=qKBjSQ1v91RyAK45QCPf5w==:117 a=nz36NW0qrpeEijYxj/H2Ew==:17 a=IkcTkHD0fZMA:10 a=pUM-KoujPXoA:10 a=M51BFTxLslgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yOCtJkima9RkubShWh1s:22 a=EUspDBNiAAAA:8 a=0H3q2PJmbIchY79ZeXIA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=NFOGd7dJGGMPyQGDc5-O:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMjAyMDA4NyBTYWx0ZWRfX/Iq8yJmh7AV4 5simGiLugQP9H9yZdmTSfeNN0iz5V4a+7W4/+SMqI5wQoqn54BHIqYycADSevJzIfBnFJv/8zWQ sSOv6CmDQyaoCTTjc9eRpldE1pqVPfzG/Yvgl38rlCMcZtgzizrv5UkVlhz2QKw18vw5ROFpEKJ PNzTEaf8Lk8zUzDB/Xpi9Gb+6iXFX2N/lX9r2epmeqY/mdeynm1GSBg57l/w7zeByZKQ0x9JNze 34ebwt1zA2LLtu70Kb02pLpWQLBHRZ8yGpAQacDLTL80blKKJUjl6STCToB46CN5yTCinJ2sIla wvcpyL8qvQH463v9j7TScnPCX2Aa8/jWU/OA2bJrpIiHl2mzLTWVQaTsKnQa3WkTFfTMzr2jIaZ xBlHGXhSQTsllZGk4KKXCXyahrZ30J1FB3McUPMhVMrFjWCJX7h6b3MgJGzjGAgXaCiwoCHjNjJ ZXsYwkWFpNgL5DJ/c0A== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-12-02_06,2026-12-02_07,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 priorityscore=1501 suspectscore=0 malwarescore=0 lowpriorityscore=0 impostorscore=0 bulkscore=0 phishscore=0 clxscore=1015 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2612020087 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.168.131; envelope-from=philmd@oss.qualcomm.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1796248331820158500 Every architecture backend hard-codes srand(0), so all generated test binaries for a given pattern set are identical. Add a '--seed N' option (default 0, so the default output is unchanged) and pass it down to the backends through the parameters hash, to get different random sequences from the same patterns. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Thomas Huth --- README | 4 ++++ risugen | 4 ++++ risugen_arm.pm | 2 +- risugen_loongarch64.pm | 2 +- risugen_m68k.pm | 2 +- risugen_ppc64.pm | 2 +- risugen_s390x.pm | 2 +- 7 files changed, 13 insertions(+), 5 deletions(-) diff --git a/README b/README index 35e8b29..58691e8 100644 --- a/README +++ b/README @@ -85,6 +85,10 @@ An alternative to using regular expression patterns is t= o use the --group specifier. This relies on the configuration file having been annotated with suitable @ markers. =20 +The generated instructions and register values are pseudo-random but +deterministic: the same options always produce the same binary. Use +--seed N (default 0) to get a different random sequence. + This binary can then be passed to the risu program, which is written in C. You need to run risu on both an ARM native target and on the program under test. The ARM native system is the 'master' diff --git a/risugen b/risugen index 2800b8b..a8a82fa 100755 --- a/risugen +++ b/risugen @@ -293,6 +293,7 @@ and outputfile is the generated raw binary file. =20 Valid options: --numinsns n : generate n instructions (default is 10000) + --seed n : seed for the random number generator (default is 0) --fpscr n : set initial FPSCR (arm) or FPCR (aarch64) value (defaul= t is 0) --condprob p : [ARM only] make instructions conditional with probabili= ty p (default is 0, ie all instructions are always executed) @@ -319,6 +320,7 @@ sub main() my $numinsns =3D 10000; my $condprob =3D 0; my $fpscr =3D 0; + my $seed =3D 0; my $fp_enabled =3D 1; my $sve_enabled =3D 0; my $big_endian =3D 0; @@ -327,6 +329,7 @@ sub main() GetOptions( "help" =3D> sub { usage(); exit(0); }, "numinsns=3Di" =3D> \$numinsns, "fpscr=3Do" =3D> \$fpscr, + "seed=3Di" =3D> \$seed, "group=3Ds" =3D> \@groups, "pattern=3Ds" =3D> \@pattern_re, "not-pattern=3Ds" =3D> \@not_pattern_re, @@ -364,6 +367,7 @@ sub main() my %params =3D ( 'condprob' =3D> $condprob, 'fpscr' =3D> $fpscr, + 'seed' =3D> $seed, 'numinsns' =3D> $numinsns, 'fp_enabled' =3D> $fp_enabled, 'sve_enabled' =3D> $sve_enabled, diff --git a/risugen_arm.pm b/risugen_arm.pm index 8d423b1..2fbac78 100644 --- a/risugen_arm.pm +++ b/risugen_arm.pm @@ -1104,7 +1104,7 @@ sub write_test_code($$$$$$$$) $condprob =3D 1 - $condprob; =20 # TODO better random number generator? - srand(0); + srand($params->{ 'seed' }); =20 print "Generating code using patterns: @keys...\n"; progress_start(78, $numinsns); diff --git a/risugen_loongarch64.pm b/risugen_loongarch64.pm index 98fbd48..6263888 100644 --- a/risugen_loongarch64.pm +++ b/risugen_loongarch64.pm @@ -495,7 +495,7 @@ sub write_test_code($) $condprob =3D 1 - $condprob; =20 # TODO better random number generator? - srand(0); + srand($params->{ 'seed' }); =20 print "Generating code using patterns: @keys...\n"; progress_start(78, $numinsns); diff --git a/risugen_m68k.pm b/risugen_m68k.pm index 7d62b13..acf5bb2 100644 --- a/risugen_m68k.pm +++ b/risugen_m68k.pm @@ -173,7 +173,7 @@ sub write_test_code($) $condprob =3D 1 - $condprob; =20 # TODO better random number generator? - srand(0); + srand($params->{ 'seed' }); =20 print "Generating code using patterns: @keys...\n"; progress_start(78, $numinsns); diff --git a/risugen_ppc64.pm b/risugen_ppc64.pm index b241172..3372b73 100644 --- a/risugen_ppc64.pm +++ b/risugen_ppc64.pm @@ -385,7 +385,7 @@ sub write_test_code($) $condprob =3D 1 - $condprob; =20 # TODO better random number generator? - srand(0); + srand($params->{ 'seed' }); =20 print "Generating code using patterns: @keys...\n"; progress_start(78, $numinsns); diff --git a/risugen_s390x.pm b/risugen_s390x.pm index 260e2dd..6cc453a 100644 --- a/risugen_s390x.pm +++ b/risugen_s390x.pm @@ -153,7 +153,7 @@ sub write_test_code($) $condprob =3D 1 - $condprob; =20 # TODO better random number generator? - srand(0); + srand($params->{ 'seed' }); =20 print "Generating code using patterns: @keys...\n"; progress_start(78, $numinsns); --=20 2.55.0