CPID: parse cpu feaures depending on the register index#64
Open
shuoo wants to merge 2 commits intoXUANTIE-RV:masterfrom
Open
CPID: parse cpu feaures depending on the register index#64shuoo wants to merge 2 commits intoXUANTIE-RV:masterfrom
shuoo wants to merge 2 commits intoXUANTIE-RV:masterfrom
Conversation
Change-Id: I1fcaee925e4068bc46faab374431bece55e065ab Signed-off-by: shuangluo.zhang <shuangluo.zhang@alibaba-inc.com> Co-authored-by: tian.he <ht412853@alibaba-inc.com>
Change-Id: I83a4386046a9341650a7351fab94d8869bffd7f5 Co-authored-by: tian.he <ht412853@alibaba-inc.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Since the read from CPID register may not always from index 0 to 6 at any time, it will lead to the error info for cpu_ver and cpu_type. This change adds the register index check before parsing.
Furthermore, the CPID spec defines 7 registers available while 2 of them are useful for zsb now, this change also minimize the register access for efficiency.
I have some basic manual test on FPGA platforms with print out after the parse. Here is the test code and results:
Code:
printf("cpu %x %x %x\n", cpu_type, cpu_ver, cpu_tnmodel);
Results:
FPGA --> print out
//C908V R1S0P12. --> cpu 5 100c 0
//R908FDV-CP-XT R0S0P15. --> cpu 2 f 0
//C920v3-CP-XT R3S1P5. --> cpu 3 3045 0
//C907FDVM-rv32 R0S1P0. --> cpu 6 40 0
//C907FDVM-rv64 R0S0P16. --> cpu 6 10 0
//C908X-CP-XT R0S0P9. --> cpu 5 9 1
As this change affects all platforms that supported by zsb, more tests for coverage are necessary.