diff --git a/.github/workflows/hugo.yaml b/.github/workflows/hugo.yaml new file mode 100644 index 0000000..b5d765a --- /dev/null +++ b/.github/workflows/hugo.yaml @@ -0,0 +1,78 @@ +# Sample workflow for building and deploying a Hugo site to GitHub Pages +name: Deploy Hugo site to Pages + +on: + # Runs on pushes targeting the default branch + push: + branches: + - main + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: "pages" + cancel-in-progress: false + +# Default to bash +defaults: + run: + shell: bash + +jobs: + # Build job + build: + runs-on: ubuntu-latest + env: + HUGO_VERSION: 0.115.4 + steps: + - name: Install Hugo CLI + run: | + wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \ + && sudo dpkg -i ${{ runner.temp }}/hugo.deb + - name: Install Dart Sass + run: sudo snap install dart-sass + - name: Checkout + uses: actions/checkout@v3 + with: + submodules: recursive + fetch-depth: 0 + - name: Setup Pages + id: pages + uses: actions/configure-pages@v3 + - name: Install Node.js dependencies + run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true" + - name: Build with Hugo + env: + # For maximum backward compatibility with Hugo modules + HUGO_ENVIRONMENT: production + HUGO_ENV: production + run: | + hugo \ + --gc \ + --minify \ + --baseURL "${{ steps.pages.outputs.base_url }}/" + - name: Upload artifact + uses: actions/upload-pages-artifact@v1 + with: + path: ./public + + # Deployment job + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v2 diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..1815d0b --- /dev/null +++ b/.gitmodules @@ -0,0 +1,4 @@ +[submodule "themes/tokiwa"] + path = themes/tokiwa + url = git@github.com:guttatus/hugo-theme-tokiwa.git + branch = gitalk diff --git a/archetypes/default.md b/archetypes/default.md new file mode 100644 index 0000000..00e77bd --- /dev/null +++ b/archetypes/default.md @@ -0,0 +1,6 @@ +--- +title: "{{ replace .Name "-" " " | title }}" +date: {{ .Date }} +draft: true +--- + diff --git a/config.toml b/config.toml new file mode 100644 index 0000000..28e38c1 --- /dev/null +++ b/config.toml @@ -0,0 +1,93 @@ +DefaultContentLanguage = "zh-cn" +author = "guttatus" +baseURL = "https://guttatus.github.io" +copyright = "Copyright ©guttatus,CC BY-SA" +disqusShortname = "guttatus" +enableInlineShortcodes = true +footnoteReturnLinkContents = "^" +googleAnalytics = "UA-FAKE" ## or "G-xxxxxxxx" in Google Analytics v4, in hugo v0.82+ +hasCJKLanguage = true +languageCode = "cn" +theme = "tokiwa" +title = "Guttatus's Blog" + +[markup] +[markup.highlight] +style = "monokailight" + +[markup.goldmark.renderer] +unsafe = true + +[markup.tableOfContents] +startLevel = 2 +endLevel = 5 +ordered = false + +[params] +bannerFont = "fonts/exampleFont" +description = """ +虽千万人吾往矣 +""" +env = "production" # for Google Analytics and DISQUS. +favicon = "img/favicon.png" +fuse = true # for searchbox. "JSON" must added to output contents. See [outputs]. +math = true # for introducing $KaTEX$ +useChineseFonts = true +postDateFormat = "2006-1-2" +enableGitalk = true + +[menu] +# Shown in the side menu. +[[menu.main]] +identifier = "post" +name = "Posts" +url = "/post/" +weight = 1 +[[menu.main]] +name = "Tags" +url = "/tags/" +weight = 2 + +[[menu.main]] +name = "Categories" +url = "/categories/" +weight = 2 + +[[menu.main]] +identifier = "about" +name = "About" +url = "/about/" +weight = 3 + +[taxonomies] +category = "categories" +series = "series" +tag = "tags" +[social] +bilibili = "https://space.bilibili.com/435228864" +github = "https://github.com/guttatus" +# gitlab = "http://gitlab.com/" +# instagram = "http://example.com/" +mail = "mailto:xingzhiang2020@gmail.com" +# twitter = "http://twitter.com/" +# weibo = "http://example.com/" +# youtube = "http://youtube.com/" +# zhihu = "http://example.com/" +# any icon in layouts/partials/svg can be used by the name without the "-line.svg" + +[outputs] +home = ["HTML", "RSS", "JSON"] + +[params.gitalk] +clientID = "de25a843e28e54ff3a20" # 您刚才创建Github Application 的 Client ID +clientSecret = "29e4adfe5bd0d694813a2bddd0f2ab03b5e0f18f" # 您刚才创建Github Application 的 Client Secret +repo = "guttatus.github.io" # 您的博客的github地址Repository name,例如:xxxx.github.io +owner = "guttatus" # 您的GitHub ID +admin= "guttatus" # 您的GitHub ID +id= "location.pathname" # 文章页面的链接地址就是ID +labels= "gitalk" # Github issue labels. If you used to use Gitment, you can change it +perPage= 15 # Pagination size, with maximum 100. +pagerDirection= "last" # Comment sorting direction, available values are 'last' and 'first'. +createIssueManually= true # 设置为true,如果是管理员登录,会自动创建issue,如果是false,需要管理员手动添加第一个评论(issue) +distractionFreeMode= false # Enable hot key (cmd|ctrl + enter) submit comment. + diff --git a/content/_index.md b/content/_index.md new file mode 100644 index 0000000..868b792 --- /dev/null +++ b/content/_index.md @@ -0,0 +1,4 @@ ++++ +author = "guttatus" ++++ + diff --git a/content/about.md b/content/about.md new file mode 100644 index 0000000..c9bc364 --- /dev/null +++ b/content/about.md @@ -0,0 +1,54 @@ ++++ +title = "About" +description = "What should I write?🤯" +date = "2023-08-09" +aliases = ["about-me","contact"] +author = "guttatus" ++++ + +# General Information + +* 🫣 Hi, I’m @[guttatus](https://github.com/guttatus) +* 👀 I’m interested in Functional Programming and Computer Architecture. +* 🌱 I’m currently learning [__Haskell__](https://www.haskell.org/) and __Verilog HDL__ +* 📪 You can reach me by xingzhiang2020@gmail.com + +# Education + + + + + + + + + + + + + + +
+ npu's logo + +

Northwestern Polytechnical University

+

Sep 2023 - Jul 2026 (expected)

+

M.Eng. in Computer Technology

+
+ Shanghai University's logo + +

Shanghai University +

Sep 2019 - Jul 2023

+

B.S. in Computer Science and Technology

+
+ diff --git a/content/archives.md b/content/archives.md new file mode 100644 index 0000000..b647e6d --- /dev/null +++ b/content/archives.md @@ -0,0 +1,5 @@ +--- +date: 2023-08-09 +type: section +layout: "archives" +--- diff --git a/content/post/_index.md b/content/post/_index.md new file mode 100644 index 0000000..465fee1 --- /dev/null +++ b/content/post/_index.md @@ -0,0 +1,5 @@ ++++ +aliases = ["posts","articles","blog","showcase","docs"] +title = "Posts" +author = "guttatus" ++++ diff --git a/content/post/at-beginning.md b/content/post/at-beginning.md new file mode 100644 index 0000000..6c9432b --- /dev/null +++ b/content/post/at-beginning.md @@ -0,0 +1,8 @@ +--- +author: guttatus +title: At Beginning +date: 2023-08-09 +description: 写在开始时 +--- + +之前写过一段时间博客,但是由于种种原因,未能坚持。在升入研究生之际,重新搭建模板,主要记录学习和生活,希望能够坚持下去。 diff --git a/content/post/cdc-1.md b/content/post/cdc-1.md new file mode 100644 index 0000000..6f50c5c --- /dev/null +++ b/content/post/cdc-1.md @@ -0,0 +1,70 @@ ++++ +author = "guttatus" +title = "跨过那个时钟域(1)" +date = "2023-08-12" +description = "浅谈数字电路设计中跨时钟域相关概念及单比特信号跨时钟域的同步处理方法" +tags = [ + "CDC", +] +categories = [ + "IC", +] +toc = true ++++ + +## 时钟域概念 +在同步时序电路中,一个时钟通常驱动(Feed)许多同步单元(触发器,同步RAM块等)。由同一时钟驱动的一组同步单元被称为该时钟的**时钟域**(Clock Domain)。 + + +## 跨时钟域概念 +**跨时钟域**(Clock Domain Crossing,CDC)是指同步数字电路中的信号从一个时钟域跨越到另一个时钟域。 + +### 亚稳态 +对于边缘触发的触发器,触发器的建立时间(setup)和保持时间(hold)在时钟上升沿左右定义了一个时间窗口。如果输入数据在该窗口发生变化,那么就会产生时序违约。此时,触发器无法稳定在0或1状态,而是徘徊在一个中间电平状态(这个中间电平可能是正确值,也可能不是),得到的结果将是不可预知的。这种状态称为**亚稳态**(Metastability)。 + +## 单比特信号跨时钟域的同步处理方法 + +当在时钟域之间传递信号时,我们需要考虑一个重要的问题:是否要对从一个时钟域传输到另一个时钟域的信号的每一个值进行采样? + +针对上述问题,当信号跨越时钟域边界时有两种可能的场景: +1. 在跨时钟域时允许丢失部分采样值。 +2. 在跨时钟域时不允许丢失任何信号采样值。 + +对于第一种场景,有时对信号的每一个值进行采样是不必要的,但是被采样的值必须要保证精确度。标准异步 FIFO 设计中使用的一组格雷码计数器就是一个例子。在设计得当的异步 FIFO 模型中,同步格雷码计数器不需要捕获来自另一时钟域的每一个合法值,但采样值必须准确无误,以便识别何时出现了满和空的情况。 + +对于第二种场景,在允许对跨时钟域信号发生改变之前,必须被正确识别或识别并确认。 + +在这两种情况下,跨时钟域信号都需要被同步到其接受时钟域中。 + +### 双触发同步器 + +> **同步器**是对异步信号进行采样,并输出与本地时钟或采样时钟同步转换的信号的设备。 + +如下图所示,数字电路设计中,最简单和普遍的是使用**双触发同步器**(Two flip-flop synchronizer),也就是所谓的“打两拍”。 + +![Two-flip-flop](/img/posts/cdc/twoflipflop.png) + +值得注意的是,即使通过使用双触发同步器消除了亚稳态,也并不意味着第二级Flop所采到的值就是**正确**的,而只能保证其是**稳定**的。 + +当然,从理论上,由于第一阶段的信号在打一拍后还是有可能处于非稳定状态,从而导致级联的第二个寄存器输出还会表现为非稳定状态。 + + +>触发器进入亚稳态的时间可以用参数 **MTBF**(mean time between failures)来描述, MTBF即触发器采样失败的时间间隔,其公式描述如下: +$$ MTBF = \frac{e^{{t_R}/\tau}}{f_df_cT_0} $$ +$t_R$ = 分辨时间(resolution time, the time after the clock edge that output data is needed) +$\tau, T_0$ = 触发器参数,由工艺决定 +$f_d$ = 数据改变频率 +$f_c$ = 采样时钟频率 +从上述公式中我们可以看出,随着时钟频率的提高或者数据改变频率的提高,失败会发生的更频繁。 + +对于大多数同步应用,双触发同步器已经足够消除可能的亚稳态了。(存疑,该结论今天是否任然适用?) + +### 三级触发同步器 +对于一些高速设计,使用两级触发器同步未必能满足要求,这时可以额外添加一级触发器来增加MTBF。 + +下图展示了一个三级触发同步器。 + + + + +## to be continued \ No newline at end of file diff --git a/static/fonts/exampleFont.woff b/static/fonts/exampleFont.woff new file mode 100644 index 0000000..6a4893e Binary files /dev/null and b/static/fonts/exampleFont.woff differ diff --git a/static/fonts/exampleFont.woff2 b/static/fonts/exampleFont.woff2 new file mode 100644 index 0000000..5505e80 Binary files /dev/null and b/static/fonts/exampleFont.woff2 differ diff --git a/static/img/favicon.png b/static/img/favicon.png new file mode 100755 index 0000000..c56101f Binary files /dev/null and b/static/img/favicon.png differ diff --git a/static/img/logo/npu.svg b/static/img/logo/npu.svg new file mode 100644 index 0000000..ed15d53 --- /dev/null +++ b/static/img/logo/npu.svg @@ -0,0 +1,3925 @@ + + + +image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/static/img/logo/shu.svg b/static/img/logo/shu.svg new file mode 100644 index 0000000..ca5a5e1 --- /dev/null +++ b/static/img/logo/shu.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/static/img/posts/cdc/threeff.png b/static/img/posts/cdc/threeff.png new file mode 100644 index 0000000..0dc4e5b Binary files /dev/null and b/static/img/posts/cdc/threeff.png differ diff --git a/static/img/posts/cdc/twoflipflop.png b/static/img/posts/cdc/twoflipflop.png new file mode 100644 index 0000000..a7a690f Binary files /dev/null and b/static/img/posts/cdc/twoflipflop.png differ diff --git a/themes/tokiwa b/themes/tokiwa new file mode 160000 index 0000000..aa034b7 --- /dev/null +++ b/themes/tokiwa @@ -0,0 +1 @@ +Subproject commit aa034b7a80580ed194d2ca531c1b5086b69f6b0e