An FPGA implementation of a RISC-V based SOC system with custom instruction set for image processing applications
Görüntü işleme uygulamaları için özel komut setine sahip RISC-V tabanlı bir SOC sısteminin FPGA gerçeklemesi
- Tez No: 683623
- Danışmanlar: PROF. DR. SIDDIKA BERNA ÖRS YALÇIN
- Tez Türü: Yüksek Lisans
- Konular: Elektrik ve Elektronik Mühendisliği, Electrical and Electronics Engineering
- Anahtar Kelimeler: Belirtilmemiş.
- Yıl: 2021
- Dil: İngilizce
- Üniversite: İstanbul Teknik Üniversitesi
- Enstitü: Fen Bilimleri Enstitüsü
- Ana Bilim Dalı: Elektronik ve Haberleşme Mühendisliği Ana Bilim Dalı
- Bilim Dalı: Elektronik Mühendisliği Bilim Dalı
- Sayfa Sayısı: 111
Özet
Günümüzde görüntü işleme için güvenilir ve hızlı donanım sistemleri hayatımızda önemli bir rol oynamaktadır. Karar verme söz konusu olduğunda, donanım üzerinde uygulanan bir görüntü işleme algoritması hızlı ve güvenilirdir. Örneğin bu günlerde sürücü yorgunluk tespit sistemleri ulaşım sektöründe çok önemli. İnsanların çoğu, sadece çok kısa bir gece uykusundan sonra, uzun yolculuklar sırasında veya değişen fiziksel koşullar sırasında, araba kullanırken uyuşukluğun kurbanı oluyor. Bu nedenle, sürücünün yorgunluğundan ve esnemesinden kaynaklanan korkunç kazaları önlemek için nakliye birimlerine uygulanan bir alarm sistemine ihtiyaç vardır. Gömülü sistemler, hız, doğruluk ve güvenilirlik gibi düşük maliyetli performans gereksinimleri sağlamak amacıyla özel olarak geliştirilmiştir. Tanım olarak, uygulamaya özel donanım ve yazılım bileşenleri içerir. Ancak hedef sistem büyüdükçe, sistemin tasarımı için işgücüne ve deneyim çeşitliliğine olan ihtiyaç artmaktadır. Bu nedenle sistemin kullanıcı kontrolü daha zor hale gelir. Bir sistemin rahatlıkla kullanılabilmesi, gerektiğinde güncellenebilmesi ve diğer gömülü sistemlere uygun çalışılabilmesi için donanım için yazılım desteğinin sağlanması çok önemlidir. Birçok uygulama, uygulamaya özel ucuz donanım birimleriyle gerçekleştirilebilir. Ancak yine de ilgi, yazılım geliştirme ortamının olmaması nedeniyle farklı uygulamaları desteklemek için tasarlanmış genel amaçlı, pahalı çözümlere yöneliktir. Öte yandan gömülü sistemlerin uygun yazılımlarla desteklenmesi ve bu sistemlere özel verimli sinyal işleme ve karar verme algoritmaları geliştirilerek gömülü sistemlerin uygulama alanları genişletilebilir. Araştırmacıların ve kullanıcıların kolayca geliştirebilecekleri gömülü sistemlerin artması, birçok uygulamanın ucuz, pratik ve değişen koşullara yanıt verebilecek nitelikte olabileceği anlamına gelir. Çalışmamızın yapı taşını oluşturan komut seti uzantısını gerçekleştirmenin en ucuz ve en uygun yöntemlerinden biri, önceden tasarlanmış bir açık kaynaklı işlemciyi değiştirmektir. Bu noktada tüm yazılım ve donanım bileşenleri ile gömülü bir sistem tasarlamak için bir tasarım sürecini takip etmek gerekir. Bu zorunluluk, bu projede seçilen özel uygulamanın uygulanması için bir temel oluşturmak için bir donanım, yazılım ve yazılım geliştirme tasarımı ortamı kombinasyonunu gerektirir. O halde, maliyete duyarlı uygulama yazılımı tasarımı son gereksinimdir. Performansı artırmak için komut seti mimarisini genişletmek için açık kaynaklı bir işlemciye ihtiyaç vardır. Projemizin SoC Uygulaması için Nexys 4 DDR FPGA OV7670 CMOS kamera modülü kullanılmıştır. Yorgunluk ve esnemeyi tespit etmek için en önemli filtre olan Laplacian filtresi IP core olarak kullanılmakta ve sisteme eklenmektedir. Son olarak, RISC-V'nin komutları, zamanı azaltmak ve tüm sistemimizin performansını iyileştirmek için genişletilmiştir. Laplacian filtresinin SoC üzerinde uygulanması için adımlar aşağıda gösterilmiştir: 1. Görüntü işleme ve modelin doğrulanması için sistemin modellenmesi 2. RISC-V işlemcinin FPGA üzerinde uygulanması 3. FPGA üzerinde uygulanan RISC-V işlemci üzerindeki Laplacian filtresi için sistem modelini gerçekleştirme 4. Özel çekirdekli konvolüsyonun RISC-V işlemcisi için komut setinin uzatılması ve FPGA üzerinde gerçekleştirilmesi RISC-V, açık kaynaklı, genişletilebilir bir komut seti mimarisidir. Performans iyileştirme için RISC-V işlemcisine özel uzantılar eklemek oldukça kolaydır ve bu da onu bu projenin amacına uygun bir mimari haline getirir. RISC-V, çeşitli uzantıları destekleyen uygulama için çeşitli çekirdeklere ve SoC'lere sahiptir. Projemiz göz önüne alındığında, çalışması, değiştirilmesi ve ALU, Instruction fetch, Instruction decoder, yürütme, geri yazma ve diğer aşamaları içeren kaynak kodlarının anlaşılması kolay olduğu için proje için Ibex çekirdeği seçilmiştir. Ayrıca, görüntü işleme uygulamalarında çok kullanışlı olan RISC-V'nin standart çarpma uzantısını da uygular. Ancak, Ibex'in bir veri yolu arabirimi veya herhangi bir çevresel birimi ile gelmemesi gibi bir dezavantajı vardır. Vga ve kamera gibi çevresel birimlerini kolayca eklemek ve kullanmak için, Ibex'in ibex_wb adı verilen değiştirilmiş bir sürümü kullanılır. Bu proje, genişletilebilir bir Wishbone veri yolu arabirim modülünü destekler. Bu protokolü kullanarak, herhangi bir Wishbone uyumlu çevresel birimi çekirdeğe bir IP olarak kolayca bağlanabilir. Temel proje, Wishbone ara bağlantısı üzerinden RAM ile iletişim kuran bir slave olarak bir LED IP içerir. LED ara bağlantısının temel görevi, bir ana ve bir köle arasındaki bağlantıyı tek bir anda kurmak için Master ve Slave'leri önceliklerine göre sıralamaktır. Komut ve veri belleğini başlatmak için C kodunu assembly diline çevirmek için Linux işletim sistemlerinde ilgili RISC-V derleyicisi kurulmuştur. Bu derleyici, Ibex çekirdek projesine dahil edilecek olan .vmem dosyasını oluşturuyor. Projenin ilk aşamasında çekirdek ve led IP'yi test etmek için bir test bench yazılır. Başarılı simülasyondan sonra Ibex projesi sentezlendi ve Nexys4DDR FPGA kartında uygulandı. Bir sonraki adımda, RAM doğrudan erişim yeteneği ile Master olarak Kamera ve VGA IP eklenmiştir. Tüm pikselleri RAM'e kaydetmek için link.ld dosyası değiştirilerek yığın bölgesinin bellek boyutu artırıldı. Video akışını kamera modülü ile aldıktan ve VGA monitörde gösterdikten sonra, görüntüye uygulamak için C dillerinde bir Laplacian filtresi yazılır. Bahsedilen işlemin yönlendirme görevleri vardır: kamera modülü ham RGB verilerini yakalar ve RAM'e yazar, Laplacian filtre algoritması ham görüntüyü işler ve hesaplamaların sonuçları belleğe geri yazılır. VGA modülleri, izlenecek çıktı görüntülerini gösterir. Yazılım ve donanım uygulamasını karşılaştırmak için, tek bir DSP birimi eklenerek Laplacian filtresinin donanım uygulaması tasarlanmış ve sistemimize uygulanmıştır. İşlem süresi göz önüne alındığında, Laplacian filtresinin yazılım uygulamasına kıyasla saf donanım uygulamasında 35 kat iyileştirme vardır. Çarpma ve toplama işlemi (MAC), görüntü işleme uygulamalarında her evrişim işleminin temel işlemidir. Donanım uygulama geliştirmelerinden esinlenerek, sisteme özel talimatlar eklenir. Derleyici kaynak kodu, derleyicinin yeni eklenen özel talimatları tanımlamasını sağlamak için düzenlendi ve yeniden oluşturuldu. Projede komut kod çözücü ve ALU kısmı bizim yönergelerimize göre değiştirilmiştir. Filtre çekirdeğini başlatan ilk özel talimat. İkinci özel talimat, 18 DSP birimi kullanılarak paralel olarak çalışan MAC'in uygulanması. Daha sonra özel talimatlar, C kodu içinde satır içi derleme yöntemi kullanılarak çağrılır. Düzgün filtreyi uygulamak için tüm çekirdek üyeleri 1/9 olmalıdır, ancak Ibex çekirdeği float uzantısını desteklemez. Bu sorunun üstesinden gelmek için, çekirdek özel komut girişinin başlatılması 16 ile çarpılır (4 bit sola kaydırma). ALU kısmında, MAC işleminin sonucu 16'ya bölünür (aritmetik sağa kaydırma ve işaret bitini koruyarak). Bu yöntem göz önüne alındığında, görüntü işleme uygulamaları için kayan çekirdekli filtreler desteklenir. Filtre uygulama yöntemleri bölüm 9'da karşılaştırılmıştır.
Özet (Çeviri)
Nowadays, reliable and fast hardware systems for image processing are playing an important role in our lives. When it comes to decision making, implemented an image processing algorithm on hardware is fast and reliable. For example, these days driver fatigue detection systems are very important in the transportation sector. Most people are victims of drowsiness while driving, simply after a too-short night's sleep, during long journeys, or altered physical condition. Hence, there is a need for an alarming system implemented in the transportation units to avoid horrible accidents caused by fatigue and yawning of the driver. Embedded systems are developed specifically for the purpose of providing low-cost performance requirements such as speed, accuracy, and reliability. By definition, it contains application-specific hardware and software components. However, as the target system grows, the need for workforce and experience diversity for the design of the system increases. Therefore, the user control of the system becomes more difficult. It is very important that software support for hardware is provided in order to be able to use a system easily, to update it if necessary, and to be able to operate in accordance with other embedded systems. Many applications can be implemented with application-specific inexpensive hardware units. However, the interest still is toward general-purpose, expensive solutions designed to support different applications because of the lack of a software development environment. On the other hand, the application areas of embedded systems can be extended by supporting the embedded systems with appropriate software and by developing efficient signal processing and decision-making algorithms specific to these systems. The increase of embedded systems where researchers and users can easily develop on them means that many applications can become cheap, practical, and capable of responding to changing conditions. One of the cheapest and most convenient methods for performing the instruction set extension that forms the building block of our work is modifying an already designed open-source processor. At this point, it is necessary to follow a design process for designing an embedded system with all its software and hardware components. This necessity requires a combination of hardware, software, and an environment for software development design in order to form a base for the implementation of the specific application chosen in this project. Then, cost-sensitive application software design is the last requirement. An open-source processor is needed in order to extend the instruction set architecture to improve performance. For the SoC Implementation of our project, Nexys 4 DDR FPGA OV7670 CMOS camera module is used. Laplacian filter, which is the most significant filter for detecting fatigue and yawning, is used as an IP core and added to the system. Finally, the instructions of RISC-V are extended to lower the time and improve the performance of our entire system. Steps for the implementation of the Laplacian filter on SoC is shown below: 1. Modeling the system for image processing and verification of the model 2. Implementation of RISC-V processor on an FPGA 3. Realizing the model of the system for Laplacian filter on the RISC-V processor implemented on the FPGA 4. Extension of the instructions of RISC-V processor for custom kernel convolution and implementation on the FPGA RISC-V is an open-source extendable instruction set architecture. It is pretty much easy to add custom extensions to the RISC-V processor for performance improvement which makes it a proper architecture for the aim of this project. RISC-V has various cores and SoCs for implementation that supporting diverse extensions. Considering our project, Ibex core is chosen for the project since it is easy to work, modify and easy to understand source codes including ALU, Instruction fetch, Instruction decoder, execute, write back, and other stages. It also implements the standard multiplication extension of RISC-V, which is very useful in image convolution applications. However, Ibex has a disadvantage in that it does not come with a bus interface or any peripherals. In order to easily add and use peripherals like VGA and camera, a modified version of Ibex, called ibex_wb is used. This project supports an extendable Wishbone bus interface module. Using this protocol, any Wishbone compatible peripheral can be connected to the core as an IP easily. The base project includes a wishbone led IP as a slave, which communicates with RAM over wishbone interconnect. The main duty of wishbone interconnect is sorting Masters and Slaves according to their priorities for establishing the connection between a master and a slave in a single moment. The related RISC-V compiler has been installed in Linux operating systems in order to translate the C code to assembly language to initialize the instruction and data memory. This compiler is generating the .vmem file, which is going to be included in the Ibex core project. A test bench is written to test the core and led IP in the first phase of the project. After successful simulation, the Ibex project has been synthesized and implemented in the Nexys4DDR FPGA board. In the next step, Camera and VGA IP have been added as masters with the RAM direct access ability. In order to save all the pixels to RAM, the memory size of the stack region has been increased by modifying link.ld file. After getting the video stream by camera module and illustrating it on a VGA monitor, a Laplacian filter is written in C languages to apply it to the image. The mentioned process has forwarding tasks: camera module captures raw RGB data and writes to RAM, Laplacian filter algorithm processes the raw image and the results of the calculations written back to memory. VGA modules show output images to monitor. In order to compare the software and hardware implementation, the hardware implementation of the Laplacian filter has been designed and implemented in our system by adding a single DSP unit. Considering the processing time, there is 35 times improvement in pure hardware implementation in compared to software implementation of Laplacian filter. Multiply and addition operation (MAC) is the base operation of every convolution process in image processing applications. Inspiring from the hardware implementation improvements, custom instructions are added to the system. The compiler source code was edited and rebuilt to make the compiler identify the newly added custom instructions. In the project, the instruction decoder and ALU part are modified according to our instructions. First custom instruction initializing the kernel of a filter. Second custom instruction, implementing the MAC operating in parallel by using 18 DSP units. Later the custom instructions are calling by using the inline assembly method inside the C code. In order to implement the Smooth filter, all the kernel members should be 1/9, however, the Ibex core doesn't support float extension. In order to overcome this problem, initializing kernel custom instruction input multiplied by 16 (shift 4 bits to left). In the ALU part, the result of the MAC operation is divided by 16 (arithmetic shift right preserving sign bit). Considering this method, filters with float kernels are either supported for image processing applications. Filter implementation methods are compared in chapter9.
Benzer Tezler
- Implementation of a neural network application using accelerator on RİSC-V architecture in FPGA
FPGA'de RİSC-V mimarisi üzerinde hızlandırıcı kullanarak yapay sinir ağı uygulaması gerçeklenmesi
AHMET ANIL DÜNDAR
Yüksek Lisans
İngilizce
2023
Elektrik ve Elektronik MühendisliğiHacettepe ÜniversitesiElektrik ve Elektronik Mühendisliği Ana Bilim Dalı
PROF. DR. ALİ ZİYA ALKAR
- An improved device identifier composition engine architecture to enhance internet of things security
Nesnelerin interneti güvenliğini artırmak için geliştirilmiş bir cihaz tanımlayıcı bileşim motoru mimarisi
YUSUF YAMAK
Yüksek Lisans
İngilizce
2023
Bilgisayar Mühendisliği Bilimleri-Bilgisayar ve KontrolHacettepe ÜniversitesiBilgisayar Mühendisliği Ana Bilim Dalı
DOÇ. DR. MURAT AYDOS
- Cycle-accurate functional simulation of Risc-V processors for embedded applications: Timing model construction, validation and performance evaluation
Gömülü uygulamalar için Risc-V işlemcilerin döngü açısından doğru işlevsel simülasyonu: Zamanlama modeli oluşturma, doğrulama ve performans değerlendirmesi
UTKUCAN DOĞAN
Yüksek Lisans
İngilizce
2024
Elektrik ve Elektronik MühendisliğiOrta Doğu Teknik ÜniversitesiElektrik-Elektronik Mühendisliği Ana Bilim Dalı
PROF. DR. ŞENAN ECE SCHMİDT
- An embedded RISC-V core with fast modular multiplication
Hızlı modüler çarpma kabiliyetli gömülü RISC-V işlemci çekirdeği
ÖMER FARUK IRMAK
Yüksek Lisans
İngilizce
2020
Bilgisayar Mühendisliği Bilimleri-Bilgisayar ve KontrolBoğaziçi ÜniversitesiBilgisayar Mühendisliği Ana Bilim Dalı
PROF. DR. ARDA YURDAKUL
- System-on-chip memory design for a domain-specific RISC-V processor
Alana özgü RISC-V işlemcisi için Çip-Üstü-Sistem'de bellek tasarımı
UTKU GÜLGEÇ
Yüksek Lisans
İngilizce
2023
Bilgisayar Mühendisliği Bilimleri-Bilgisayar ve Kontrolİhsan Doğramacı Bilkent ÜniversitesiBilgisayar Mühendisliği Ana Bilim Dalı
PROF. DR. ÖZCAN ÖZTÜRK