Forum Discussion
Altera_Forum
Honored Contributor
11 years agoHi guys.
I used "Altera JTAG-to-Avalon-MM Tutorial" to simulate My custom hardware which is like this: https://www.alteraforum.com/forum/attachment.php?attachmentid=10029 and the way i communicate with it last time in DE2 board through NIOS was like this:#include<stdio.h>
# include<unistd.h>
# include "system.h"
# include "alt_types.h"
# include <io.h>
# ifndef loadstart
# define loadstart 0x0
# endif
# ifndef loadnxt
# define loadnxt 0x1
# endif
# ifndef loadwe
# define loadwe 0x2
# endif
# ifndef loadeaddr
# define loadeaddr 0x3
# endif
# ifndef loadAi0
# define loadAi0 0x4
# endif
# ifndef loadAi1
# define loadAi1 0x5
# endif
# ifndef loadAi2
# define loadAi2 0x6
# endif
# ifndef loadAi3
# define loadAi3 0x7
# endif
# ifndef loadBi0
# define loadBi0 0x8
# endif
# ifndef loadBi1
# define loadBi1 0x9
# endif
# ifndef loadBi2
# define loadBi2 0xA
# endif
# ifndef loadBi3
# define loadBi3 0xB
# endif
# ifndef readsum
# define readsum 0xC
# endif
# ifndef readpdone
# define readpdone 0xD
# endif
# ifndef readdone
# define readdone 0xE
# endif
void matrixmul(int A,int B,int C)
{ int k=0;
IOWR(MATRIXMUL_0_BASE,loadwe,1);
int i,l,m;
for(i=0; i<16; i++)
{
int j=0;
while(j<16)
{
IOWR(MATRIXMUL_0_BASE,loadeaddr,k);
IOWR(MATRIXMUL_0_BASE, loadAi0, A);
IOWR(MATRIXMUL_0_BASE, loadAi1, A);
IOWR(MATRIXMUL_0_BASE, loadAi2, A);
IOWR(MATRIXMUL_0_BASE, loadAi3, A);;
IOWR(MATRIXMUL_0_BASE, loadBi0, B);
IOWR(MATRIXMUL_0_BASE, loadBi1, B);
IOWR(MATRIXMUL_0_BASE, loadBi2, B);
IOWR(MATRIXMUL_0_BASE, loadBi3, B);
... But Now I dont know how to communicate with my custom hardware in testbench using "avalon_write" or "avalon_read" since I need to access this signals directly: input clk, reset; input chipselect; input [2:0] address; input write; input [31:0] writedata; output [31:0] readdata; I would appreciate if somebody help me. regards