toms.log
2019/09/22
ROMの実装方法
ROMの実装方法を調べていたらいろいろ方法があったので紹介.
intel FPGAが推奨するHDLの構文が『[Intel Quartus Prime Pro Edition User Guide: Design Recommendations](https://www.intel.com/content/www/jp/ja/programmable/documentation/sbc1513987577203.html)』[[1](#hdlcode)]に記載されているが, その中のROMの記述が普段使っているものと違ったので比較してみた. 例として以前素数を数えるFPGAを作ったときの素数テーブルを実装する. [toms.log: ハードウェアで素数を数える](https://toms-log.blogspot.com/2019/03/blog-post_18.html) ### VHDL constant宣言 constant宣言を使った実装はconstantな配列を宣言してそれをそのまま使うという方法. 『VHDLデジタル回路設計 標準講座』[[2](#vhdl_Zwolinski)]に載ってた.
[https://github.com/toms74209200/PRIME_ROM/tree/master/vhdl_constant/PRIME_ROM.vhd](https://github.com/toms74209200/PRIME_ROM/tree/master/vhdl_constant/PRIME_ROM.vhd) ### VHDL case文 『Intel~』[[1](#hdlcode)]で推奨される記述. 配列を使わずにcase文で値をスイッチしている感じ. 動作と定数テーブルがくっついているのでめっちゃ記述しにくい.
[https://github.com/toms74209200/PRIME_ROM/blob/master/vhdl_case/PRIME_ROM.vhd](https://github.com/toms74209200/PRIME_ROM/blob/master/vhdl_case/PRIME_ROM.vhd) ### Verilog case文 Verilog-HDLの場合もVHDLと同じくcase文で書くことが推奨されるらしい.
[https://github.com/toms74209200/PRIME_ROM/blob/master/verilog_case/PRIME_ROM.v](https://github.com/toms74209200/PRIME_ROM/blob/master/verilog_case/PRIME_ROM.v) ### Verilog initial文 Verilog-HDL特有のinitial文を使った記述方法. VHDLのconstantによる実装に近い.
[https://github.com/toms74209200/PRIME_ROM/blob/master/verilog_initial/PRIME_ROM.v](https://github.com/toms74209200/PRIME_ROM/blob/master/verilog_initial/PRIME_ROM.v) ## 結果 以下に結果を載せる. ターゲットデバイスはCyclone V(5CSEBA6U19C6). コンパイラはQuartus Prime 17.1.0だ. | 方式 | Logic utilization | Total registers | Total block memory bits | Total RAM Blocks | | --------------- | ----------------- | --------------- | ----------------------- | ---------------- | | VHDL constant | 224 | 13 | 0 | 0 | | VHDL case | 1,112 | 13 | 0 | 0 | | Verilog case | 1,112 | 13 | 0 | 0 | | Verilog initial | 1 | 0 | 19,648 | 4 | 驚くべきことにVHDL constantが最も実装量が小さくなった. Verilog-HDLでは実装できない方法なので『Intel~』[[1](#hdlcode)]では載っていないということなんだろうか. 問題がVerilog initial文の方式で, メモリとして実装されてしまい大量のRAMを消費している. Verilog-HDLで記述するときにVHDL constantのような簡単な書き方はできないんだろうか. ## 参考 [1]
[Intel Quartus Prime Pro Edition User Guide: Design Recommendations](https://www.intel.com/content/www/jp/ja/programmable/documentation/sbc1513987577203.html) [2]
VHDLデジタル回路設計 標準講座, Mark Zwolinski, 翔泳社 2007
0 件のコメント:
コメントを投稿
次の投稿
前の投稿
ホーム
登録:
コメントの投稿 (Atom)
0 件のコメント:
コメントを投稿