C-L-G / My_Opensource_AZPR_SOC

根据最近看的一本书编写的对应RTL以及Testbench
https://github.com/C-L-G/azpr_soc
Apache License 2.0
19 stars 9 forks source link

关于verilog和coq #1

Closed FPGA1988 closed 7 years ago

FPGA1988 commented 8 years ago
在做这个项目的过程中,突然有一天想要看看自己的项目里面的编程语言统计,查看步骤如下:
  1. 选中repository的主页,如本项目主页: https://github.com/C-L-G/azpr_soc
  2. 点击项目overview的彩条可以切换到language detail : p1 p2 点击coq后发现,其实其中的coq文件全部是里面的.v文件,verilog文件为何被识别成coq文件呢 p3
  3. 网上搜索了一下coq有如下描述:

Coq is a formal proof management system. It provides a formal language to write mathematical definitions, executable algorithms and theorems together with an environment for semi-interactive development of machine-checked proofs. Typical applications include the certification of properties of programming languages (e.g. the CompCert compiler certification project, or the Bedrock verified low-level programming library), the formalization of mathematics (e.g. the full formalization of the Feit-Thompson theorem or homotopy type theory) and teaching.

详细关于coq的说明可以参考网站 : https://coq.inria.fr

FPGA1988 commented 8 years ago

继续上述问题,经过资料查阅,Github是通过以下程序进行language的检查,点击链接以进入对应的repository : Linguist-GitHub代码语言检查工具 关于Linguist

This library is used on GitHub.com to detect blob languages, ignore binary or vendored files, suppress generated files in diffs, and generate language breakdown graphs.

继续分析linguist的lib发现以下内容

Coq:
  type: programming
  extensions:
  - ".coq"
  - ".v"
  ace_mode: text
  language_id: 69
...
Verilog:
  type: programming
  color: "#b2b7f8"
  extensions:
  - ".v"
  - ".veo"
  ace_mode: verilog
  codemirror_mode: verilog
  codemirror_mime_type: text/x-verilog
  language_id: 387

结果很明显了,两个都是有.v为后缀的文件,这个没办法改,只能看下怎么修改verilog才能不让其识别为coq了,因为其实在我的repository里有很多verilog被正确的识别了。

在Linguist中有以下描述,

The Language stats bar displays languages percentages for the files in the repository. The percentages are calculated based on the bytes of code for each language as reported by the List Languages API. If the bar is reporting a language that you don't expect: Click on the name of the language in the stats bar to see a list of the files that are identified as that language.

  1. If you see files that you didn't write, consider moving the files into one of the paths for vendored code, or use the manual overrides feature to ignore them.
  2. If the files are being misclassified, search for open issues to see if anyone else has already reported the issue. Any information you can add, especially links to public repositories, is helpful.
  3. If there are no reported issues of this misclassification, open an issue and include a link to the repository or a sample of the code that is being misclassified.

根据其中的第二条,感觉直接找现成的issue比较靠谱,所以直接到linguist中查找相关的内容,果然找到很多啊... issue_1_4 其中Coq / Verilog Misdetections看着蛮接近的,然后点击进去查看,得出结果如下:

FPGA1988 commented 7 years ago

根据上述linguist中提到的第一条

If you see files that you didn't write, consider moving the files into one of the paths for vendored code, or use the manual overrides feature to ignore them

可以考虑采用手动override的方式来进行,翻到后续手动覆盖的介绍如下:


Overrides

Linguist supports a number of different custom overrides strategies for language definitions and vendored paths.

Using gitattributes

Add a .gitattributes file to your project and use standard git-style path matchers for the files you want to override to set linguist-documentation, linguist-language, and linguist-vendored. .gitattributes will be used to determine language statistics, but will not be used to syntax highlight files. To manually set syntax highlighting, use Vim or Emacs modelines.

$ cat .gitattributes
*.rb linguist-language=Java

根据以上描述,我在azpr_soc下新建了一个.gitattributes的文件,并且将文件内容改为了

*.v linguist-language=Verilog

这个方法也是一个用得比较多的方法,但是使用后效果依旧没有改变...


2016/12/5 早上来看的时候,彩条已经将coq合并到了Verilog中,但是点击Verilog看详细的language的时候,依旧还是coq和verilog分开的,所以这个方法可以说治标不治本,还是研究研究怎么区分coq和verilog比较好~~ issue_1_5 issue_1_6