CN107665159B - 安全处理器跳转指令固定执行时间的测试方法 - Google Patents

安全处理器跳转指令固定执行时间的测试方法 Download PDF

Info

Publication number
CN107665159B
CN107665159B CN201610596521.7A CN201610596521A CN107665159B CN 107665159 B CN107665159 B CN 107665159B CN 201610596521 A CN201610596521 A CN 201610596521A CN 107665159 B CN107665159 B CN 107665159B
Authority
CN
China
Prior art keywords
jump instruction
time
fixed
execution time
execution
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201610596521.7A
Other languages
English (en)
Other versions
CN107665159A (zh
Inventor
戴昭君
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Huahong Integrated Circuit Co Ltd
Original Assignee
Shanghai Huahong Integrated Circuit Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Huahong Integrated Circuit Co Ltd filed Critical Shanghai Huahong Integrated Circuit Co Ltd
Priority to CN201610596521.7A priority Critical patent/CN107665159B/zh
Publication of CN107665159A publication Critical patent/CN107665159A/zh
Application granted granted Critical
Publication of CN107665159B publication Critical patent/CN107665159B/zh
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/22Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing
    • G06F11/2205Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing using arrangements specific to the hardware being tested
    • G06F11/2236Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing using arrangements specific to the hardware being tested to test CPU or processors
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/22Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing
    • G06F11/2273Test methods

Abstract

本发明公开了一种安全处理器跳转指令固定执行时间的测试方法,编写嵌入式汇编程序,在固定跳转指令执行时间功能打开与关闭的情况下,执行跳转指令100次,分别使用计数器记录时间,根据规则比对时间。本发明能有效自动化测试,无人工干预。

Description

安全处理器跳转指令固定执行时间的测试方法
技术领域
本发明涉及嵌入式处理器测试领域,特别是涉及一种安全处理器跳转指令固定执行时间的测试方法。
背景技术
嵌入式处理器目前会受到各种攻击,其中时序攻击是很重要也很有效果的一种攻击方式。其利用存储器不同指令种类固有的执行速度差异,分析指令特征以进行针对性的攻击,而跳转指令因为涉及到关键路径的判断,更是攻击的重点。因此现在一般设计的嵌入式处理器都对此有所防御,增加固定指令执行时间的功能。以跳转指令为例,在常规速度性能优先的情况下,直接跳转指令的执行时间为1clk(时钟);而在固定跳转时间的设置条件下,执行时间可固定为3clk。
发明内容
本发明要解决的技术问题是提供一种安全处理器跳转指令固定执行时间的测试方法,能有效进行自动化测试,无人工干预。
为解决上述技术问题,本发明的安全处理器跳转指令固定执行时间的测试方法,是采用如下技术特征实现的:
编写嵌入式汇编程序,使用计数器在固定跳转指令时间功能开启与关闭的情况下,分别计算设定次数的跳转指令的执行时钟数,根据固定跳转指令时间增加的时钟数,判断是否在原先不固定跳转指令时间的基础上增加相应的倍数;多次执行所述设定次数的固定次数的跳转指令,判断多次执行时间的一致性。
所述设定次数为100次。
固定跳转时间是控制器的一个功能,在安全功能审查时,又因为控制器指令时序的不易控制与时间很短,很难在样品上以某个程序或现象体现。采用本发明的方法,在样品阶段能够以直观的方式说明固定跳转时间这个功能的有效性。并且能有效进行自动化测试,无人工干预。以计数器的方式计算时钟clk个数,精确到了指令执行的最小单位,能够精准的得出为了安全,固定的时间增加了多少,是否符合设计预期。在ROM或RAM中存储所述嵌入式汇编程序,使用本发明方法,也可以用于设计芯片前端验证用例,以避免一般用例验证不准确。
具体实施方式
所述安全处理器跳转指令固定执行时间的测试方法,涉及的是具有安全抗时序攻击的嵌入式处理器的跳转指令执行时间的测试。具体实现的方法是,编写嵌入式汇编程序,使用计数器在固定跳转指令执行时间功能开启与关闭的情况下,分别计算设定次数的跳转指令的执行时钟数。因安全处理器固定跳转时间时,跳转指令的执行周期会增加N个clk周期(N根据不同的处理器而不同),又因为一次执行多出的N个clk时间太少不方便计算,易出现误差,故以执行多次M次的方式计算。根据固定跳转指令时间增加的时钟数,判断是否在原先不固定跳转指令时间的基础上增加相应的clk数:M*N个(*表示乘号)。多次执行所述设定次数的固定次数的跳转指令,判断多次执行时间的一致性。M,N均为大于1的正整数。
在实施时,先关闭固定跳转指令执行时间功能,因一次跳转的时间不足以在芯片端有所体现,故采用跳转100次的方式进行统计,利用计数器记录这段时间所需要的时钟个数Count1。打开固定跳转指令执行时间功能,重复以上操作,得到时钟个数Count2。根据设计预期,固定跳转时间会使得指令执行时间增加N个时钟clk,故判断Count2-Count1>=N*100±E,E为余量,可以按情况设定。若满足,则固定跳转时间符合设计预期。
本发明的测试方案还包括M次进行固定跳转时间情况下的跳转测试,得到M个Count21~Count2M,确认时间的一致性。
本发明的测试方案需要编写嵌入式汇编程序以实现以上步骤,因为嵌入式汇编程序能够有效地控制指令执行序列,避免C语言因为编译器编译出现的指令不可控。
本发明测试方案准确性的前提是:嵌入式汇编程序的执行载体必须是处理器读取程序时间迅速的存储空间,如ROM或者RAM。不能是读取程序代码时间长的存储器,否则计时时间中夹杂了大量的程序执行时间,不能很好的体现跳转指令本身的差异。
以下是本发明的汇编源码(以ARM处理器):
Figure BDA0001060872030000031
Figure BDA0001060872030000041
Figure BDA0001060872030000051
以上通过具体实施方式和实施例对本发明进行了详细的说明,但这些并非构成对本发明的限制。在不脱离本发明原理的情况下,本领域的技术人员还可做出许多变形和改进,这些也应视为本发明的保护范围。

Claims (2)

1.一种安全处理器跳转指令固定执行时间的测试方法,其特征在于:
编写嵌入式汇编程序,使用计数器在固定跳转指令时间功能开启与关闭的情况下,分别计算设定次数的跳转指令的执行时钟数,根据固定跳转指令时间增加的时钟数,判断是否在原先不固定跳转指令时间的基础上增加相应的倍数;多次执行所述设定次数的固定次数的跳转指令,判断多次执行时间的一致性,所述设定次数为100次。
2.如权利要求1所述的方法,其特征在于:所述嵌入式汇编程序存储在ROM或者RAM。
CN201610596521.7A 2016-07-27 2016-07-27 安全处理器跳转指令固定执行时间的测试方法 Active CN107665159B (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610596521.7A CN107665159B (zh) 2016-07-27 2016-07-27 安全处理器跳转指令固定执行时间的测试方法

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610596521.7A CN107665159B (zh) 2016-07-27 2016-07-27 安全处理器跳转指令固定执行时间的测试方法

Publications (2)

Publication Number Publication Date
CN107665159A CN107665159A (zh) 2018-02-06
CN107665159B true CN107665159B (zh) 2022-07-12

Family

ID=61114285

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610596521.7A Active CN107665159B (zh) 2016-07-27 2016-07-27 安全处理器跳转指令固定执行时间的测试方法

Country Status (1)

Country Link
CN (1) CN107665159B (zh)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111831521B (zh) * 2019-04-18 2023-04-11 深圳市汇顶科技股份有限公司 中断响应时间的测试方法、处理器与电子设备
CN117806979A (zh) * 2024-03-01 2024-04-02 芯来智融半导体科技(上海)有限公司 指令执行时间一致性测试方法、系统、设备及存储介质

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6446196B1 (en) * 1999-02-17 2002-09-03 International Business Machines Corporation Method apparatus and computer program product including one-of and one-of-and-jump instructions for processing data communications

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6249893B1 (en) * 1998-10-30 2001-06-19 Advantest Corp. Method and structure for testing embedded cores based system-on-a-chip
US6609216B1 (en) * 2000-06-16 2003-08-19 International Business Machines Corporation Method for measuring performance of code sequences in a production system
JP2005242569A (ja) * 2004-02-25 2005-09-08 Fujitsu Ltd データ処理装置設計方法、データ処理装置設計装置及びプログラム
US8074059B2 (en) * 2005-09-02 2011-12-06 Binl ATE, LLC System and method for performing deterministic processing
US7784040B2 (en) * 2005-11-15 2010-08-24 International Business Machines Corporation Profiling of performance behaviour of executed loops
CN102567164A (zh) * 2011-12-23 2012-07-11 中国科学院自动化研究所 用于处理器的指令集批量测试装置与方法
CN103198002B (zh) * 2012-01-09 2015-03-25 上海海尔集成电路有限公司 程序运行时间的测量方法及仿真器

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6446196B1 (en) * 1999-02-17 2002-09-03 International Business Machines Corporation Method apparatus and computer program product including one-of and one-of-and-jump instructions for processing data communications

Also Published As

Publication number Publication date
CN107665159A (zh) 2018-02-06

Similar Documents

Publication Publication Date Title
US7596781B2 (en) Register-based instruction optimization for facilitating efficient emulation of an instruction stream
EP3249535B1 (en) Assessing performance of a hardware design using formal verification
US9996127B2 (en) Method and apparatus for proactive throttling for improved power transitions in a processor core
CN107665159B (zh) 安全处理器跳转指令固定执行时间的测试方法
US20240061664A1 (en) Computer-implemented method for automatically determining a target architecture
BRPI0609195A2 (pt) parada de espera por operando fonte quando instruÇço condicional nço for executada
CN109240701B (zh) 一种面向谓词执行高性能dsp的指令依赖关系分析方法
CN106095631B (zh) 一种基于有限状态机实现的多周期非流水线cpu动态调试方法
US11461220B2 (en) Techniques to identify improper information in call stacks
US10540254B2 (en) Technologies for analyzing persistent memory programs
CN114780409A (zh) 基于程序运行进程的断点设置方法、电子设备和存储介质
US20090210839A1 (en) Timing closure using multiple timing runs which distribute the frequency of identified fails per timing corner
CN107592924B (zh) 用于对由处理器执行的指令进行优化的方法和装置
KR101947737B1 (ko) 명시적 및 암시적 정보 흐름 추적 방법 및 그 장치
CN112445486A (zh) 基于编译指导的有读写依赖循环的多线程并行方法
CN106021041B (zh) 基于有限状态机的多周期非流水线cpu调试方法
CN201188216Y (zh) 浮点异常处理装置
US20130007424A1 (en) Cascading indirect branch instructions
Karimi et al. Impact analysis of performance faults in modern microprocessors
Ahmad et al. A performance counter-based control flow checking technique for multi-core processors
Mohr et al. Synthesizing Hardware-Software Leakage Contracts for RISC-V Open-Source Processors
US20100251213A1 (en) Method for executing debug commands
CN113946539B (zh) 一种dsp处理器及其循环跳转指令的处理方法
CN102364432B (zh) 使用双程序计数器计算待处理指令地址的系统
CN101221492B (zh) 浮点异常处理装置以及用该装置进行异常处理的方法

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant