T
Ted
Guest
Hello Guys,
I am using the SOPC builder to design a simple system that integrates
a couple of UARTS, a soft processor and a VHDL blackbox (Connected
internally in user design logic). I export a 8-bit wide signal which
are connected to LEDs on-board from the blackbox. I am using the Nios
Development Board Pro Edition. My VHDL code is as follows:
Libraries blah blah...
entity count is
port(
clk: in std_logic;
write_con: in std_logic;
chipsel: in std_logic;
write_data: in std_logic_vector(1 downto 0);
export
dataout: out std_logic_vector(7 downto 0));
end count;
architecture RTL of count is
signal counter: std_logic_vector(7 downto 0);
signal write_data_d: std_logic_vector(1 downto 0);
signal resetn_d: std_logic;
signal control: std_logic;
begin
control<= write_con and chipsel;
count_proc: process(clk, control, counter, write_data)
begin
if clk'event and clk='1' then
if ((write_data="00") and control='1') then
counter<=(OTHERS=>'1');
elsif ((write_data="01") and control='1') then
counter<=counter+1;
elsif ((write_data="10") and control='1') then
counter<="00001111";
else
counter<= "01010000";
end if;
end if;
end process count_proc;
dataout<= counter;
end RTL;
////////////////////////////////////////////////////////////////////////////
My C code in the src directory is as follows:
#define point1 *((int *)(na_user_logic_altera_avalon_pwm_0_base))
void main()
{
while(1)
{
point1=1;
}
}
I am assuming that I am writing directly to the write_data port (In
VHDL) so I should be expecting a dim LED for the MSB and a bright one
at the LSB. However, all I get is 2 bright LEDs (else condition). I
checked the manuals but there wasn't any explicit instructions on how
to use the header files for user design logic. Any direct help will be
greatly appreaciated. Any reference to material will also be welcomed
too. Cheerio!
Ted
I am using the SOPC builder to design a simple system that integrates
a couple of UARTS, a soft processor and a VHDL blackbox (Connected
internally in user design logic). I export a 8-bit wide signal which
are connected to LEDs on-board from the blackbox. I am using the Nios
Development Board Pro Edition. My VHDL code is as follows:
Libraries blah blah...
entity count is
port(
clk: in std_logic;
write_con: in std_logic;
chipsel: in std_logic;
write_data: in std_logic_vector(1 downto 0);
export
dataout: out std_logic_vector(7 downto 0));
end count;
architecture RTL of count is
signal counter: std_logic_vector(7 downto 0);
signal write_data_d: std_logic_vector(1 downto 0);
signal resetn_d: std_logic;
signal control: std_logic;
begin
control<= write_con and chipsel;
count_proc: process(clk, control, counter, write_data)
begin
if clk'event and clk='1' then
if ((write_data="00") and control='1') then
counter<=(OTHERS=>'1');
elsif ((write_data="01") and control='1') then
counter<=counter+1;
elsif ((write_data="10") and control='1') then
counter<="00001111";
else
counter<= "01010000";
end if;
end if;
end process count_proc;
dataout<= counter;
end RTL;
////////////////////////////////////////////////////////////////////////////
My C code in the src directory is as follows:
#define point1 *((int *)(na_user_logic_altera_avalon_pwm_0_base))
void main()
{
while(1)
{
point1=1;
}
}
I am assuming that I am writing directly to the write_data port (In
VHDL) so I should be expecting a dim LED for the MSB and a bright one
at the LSB. However, all I get is 2 bright LEDs (else condition). I
checked the manuals but there wasn't any explicit instructions on how
to use the header files for user design logic. Any direct help will be
greatly appreaciated. Any reference to material will also be welcomed
too. Cheerio!
Ted