2023년 8월 14일 월요일

OpenRAM 오픈소스 메모리 컴파일러(RAM/ROM 생성기)

OpenRAM 오픈소스 메모리 컴파일러(RAM/ROM 생성기)

시스템 반도체에서 소프트웨어는 큰 비중을 차지한다. CPU 뿐만 아니라 기본 펌웨어(모니터)를 운영하기 위해 메모리를 내장 토록한다. 메모리는 치밀하게 반복된 구조를 가지고 있을 뿐만 아니라 디지털 비트로 따지면 매우 규모가 크다. 따라서 집적도가 높도록 따로 모아 생성한다.

OpenRAM은 메모리 RAM과 ROM을 생성해주는 도구다. 아래 링크를 참조한다.

    https://openram.org/

설치는 Git 을 통해 생성 스크립트를 내려 받을 수 있다. 주로 Python과 Makefile을 이용한 스크립트들이고 그외 PDK 가 필요하다. 도커(docker) 기반으로 설치하는 까닭에 온갖 것들을 다 끌어와서 쓸데없이 용량이 커진다(Python 기반이라 anaconda 또는 miniconda와 관련 패키지를 모두 끌어온다). 나중에 설치 최적화 할 때 정리하면 좋겠으나 설명 문서에 따르면 폴더구조를 바꾸지 말기를 권장 하고 있다.

스크립트를 내려받자.

    $ git clone https://github.com/VLSIDA/OpenRAM

준비된 예제를 실행 시켜보자.

    $ cd OpenRAM
    $ source setpaths.sh    # Env. vars for OpenRAM
    $ cd macros            # Examples
    $ make

파라메터 없이 make 유틸리티를 실행하면 아래와 같은 메시가 나타난다. 준비된 예제들의 목록이다.

Using OpenRAM at /home/goodkook/opencircuits/OpenRAM/compiler
 (which is version v1.2.29)
SRAM Configurations:
 - example_config_1rw_1r_scn4m_subm
 - example_config_1rw_1w_scn4m_subm
 - example_config_1rw_2mux_scn4m_subm
 - example_config_1w_1r_scn4m_subm
 - example_config_2rw_scn4m_subm
 - example_config_big_scn4m_subm
 - example_config_freepdk45
 - example_config_giant_scn4m_subm
 - example_config_medium_scn4m_subm
 - example_config_scn4m_subm
 - freepdk45_sram_1rw1r_32x2048_8
 - scn4m_subm_sram_16kbyte_1rw1r_32x4096_8
 - scn4m_subm_sram_1kbyte_1rw1r_32x256_8
 - scn4m_subm_sram_2kbyte_1rw1r_32x512_8
 - scn4m_subm_sram_32kbyte_1rw1r_2x32x4096_8
 - scn4m_subm_sram_4kbyte_1rw1r_32x1024_8
 - scn4m_subm_sram_8kbyte_1rw1r_32x2048_8
 - sky130_sram_1kbyte_1r1w_8x1024_8
 - sky130_sram_1kbyte_1rw1r_32x256_8
 - sky130_sram_1kbyte_1rw1r_8x1024_8
 - sky130_sram_1kbyte_1rw_32x256_8
 - sky130_sram_1rw1r_tiny
 - sky130_sram_1rw_tiny
 - sky130_sram_2kbyte_1rw1r_32x512_8
 - sky130_sram_2kbyte_1rw_32x512_8
 - sky130_sram_4kbyte_1rw1r_32x1024_8
 - sky130_sram_4kbyte_1rw_32x1024_8
 - sky130_sram_4kbyte_1rw_64x512_8
ROM Configurations:
 - sky130_rom_1kbyte

이 중에서 하나를 골라서,

    $ make example_config_1rw_1r_scn4m_subm

메모리 컴파일러를 작동 시키기 위한 도구들을 검사하는데, 처음 실행인 경우 OpenRAM/miniconda 에 독립 실행할 수 있도록 도커(docker)를 구성한다. 이때 온갖 필요한 패키지들을 끌어온다. OpenRAM/miniconda/bin 폴더를 보면 익히 봐왔던 magic, netgen 등이 포함되어 있음을 알 수 있다. 굳이 이래야 하나 싶지만 하드디스크 용량은 풍부하고 사용자 마다 설치 환경이 다르니 일일이 설치하는데 곤란을 겪지 않도록 배려 했다. 도커(Docker)의 큰 목적 이기도 하고......

도커를 구성하던 중간에 에러 메시지가 뜬다.

ERROR: Could not open requirements file: [Errno 2] No such file or directory: 'requirements.txt'

도커를 구성하는데 필요한 패키지 목록 파일을 못찾았다는 불평이다. 이어서, 아래와 같은 문구를 보게 된다.

Traceback (most recent call last):
  File "/home/goodkook/opencircuits/OpenRAM/sram_compiler.py", line 42, in <module>
    openram.init_openram(config_file=args[0])
  File "/home/goodkook/opencircuits/OpenRAM/compiler/globals.py", line 205, in init_openram
    from openram import characterizer
  File "/home/goodkook/opencircuits/OpenRAM/compiler/characterizer/__init__.py", line 14, in <module>
    from .linear_regression import *
  File "/home/goodkook/opencircuits/OpenRAM/compiler/characterizer/linear_regression.py", line 8, in <module>
    from sklearn.linear_model import Ridge
ModuleNotFoundError: No module named 'sklearn'
make[1]: *** [Makefile:85: example_config_1rw_1w_scn4m_subm.ok] Error 1
make: *** [Makefile:95: example_config_1rw_1w_scn4m_subm] Error 2

Make 유틸리티가 작동 하면서 에러가 났을 경우 그 이유를 보려준다. Python의 sklearn 이라는 모듈이 설치되어 있지 않다고 한다. Python의 추가 모듈 설치는 pip로 한다.

    $ sudo pip3 install scikit-learn

다시 make 유틸리티를 실행 시켜보자.

    $ make example_config_1rw_1r_scn4m_subm

필요한 도구들이 준비되었다면 성공적으로 메모리가 생성될 것이다. 이제 도구는 준비되었다. PDK에 맞도록 포팅할 일이 남았다.


댓글 없음:

댓글 쓰기