EmbDev.net

Forum: FPGA, VHDL & Verilog char count application


von Junior H. (Company: University) (junior_hpc)


Rate this post
0 useful
not useful
Hello. I have developed a char count application. Basically, this 
application counts the number of "a" chars given in the input file and 
it outputs the total number of "a" chars.

Here my code:
1
library ieee;
2
use ieee.std_logic_1164.all;
3
use ieee.std_logic_unsigned.all;
4
use ieee.numeric_std.all;
5
6
entity xillydemo is
7
  port (
8
     PCIE_PERST_B_LS : IN std_logic;
9
     PCIE_REFCLK_N : IN std_logic;
10
     PCIE_REFCLK_P : IN std_logic;
11
     PCIE_RX_N : IN std_logic_vector(3 DOWNTO 0);
12
     PCIE_RX_P : IN std_logic_vector(3 DOWNTO 0);
13
     GPIO_LED : OUT std_logic_vector(3 DOWNTO 0);
14
     PCIE_TX_N : OUT std_logic_vector(3 DOWNTO 0);
15
     PCIE_TX_P : OUT std_logic_vector(3 DOWNTO 0));
16
end xillydemo;
17
18
architecture sample_arch of xillydemo is
19
    signal tmp :  std_logic_vector(7 DOWNTO 0);
20
  
21
22
  component xillybus
23
    port (
24
      PCIE_PERST_B_LS : IN std_logic;
25
      PCIE_REFCLK_N : IN std_logic;
26
      PCIE_REFCLK_P : IN std_logic;
27
      PCIE_RX_N : IN std_logic_vector(3 DOWNTO 0);
28
      PCIE_RX_P : IN std_logic_vector(3 DOWNTO 0);
29
      GPIO_LED : OUT std_logic_vector(3 DOWNTO 0);
30
      PCIE_TX_N : OUT std_logic_vector(3 DOWNTO 0);
31
      PCIE_TX_P : OUT std_logic_vector(3 DOWNTO 0);
32
      bus_clk : OUT std_logic;
33
      quiesce : OUT std_logic;
34
      
35
      user_r_read_8_rden : OUT std_logic;
36
      user_r_read_8_empty : IN std_logic;
37
      user_r_read_8_data : IN std_logic_vector(7 DOWNTO 0);
38
      user_r_read_8_eof : IN std_logic;
39
      user_r_read_8_open : OUT std_logic;
40
      user_w_write_8_wren : OUT std_logic;
41
      user_w_write_8_full : IN std_logic;
42
      user_w_write_8_data : OUT std_logic_vector(7 DOWNTO 0);
43
      user_w_write_8_open : OUT std_logic);
44
  end component;
45
46
  component fifo_8x2048
47
    port (
48
      clk: IN std_logic;
49
      srst: IN std_logic;
50
      din: IN std_logic_VECTOR(7 downto 0);
51
      char_a: IN integer;
52
      wr_en: IN std_logic;
53
      rd_en: IN std_logic;
54
      dout: OUT std_logic_VECTOR(7 downto 0);
55
      full: OUT std_logic;
56
      empty: OUT std_logic);
57
  end component;
58
59
60
-- Synplicity black box declaration
61
  attribute syn_black_box : boolean;
62
  attribute syn_black_box of fifo_8x2048: component is true;
63
  
64
  signal bus_clk :  std_logic;
65
  signal quiesce : std_logic;
66
67
  signal reset_8 : std_logic;
68
69
  signal ram_addr : integer range 0 to 31;
70
 
71
  signal user_r_read_8_rden  :  std_logic;
72
  signal user_r_read_8_empty :  std_logic;
73
  signal user_r_read_8_data  :  std_logic_vector(7 DOWNTO 0);
74
  signal user_r_read_8_eof   :  std_logic;
75
  signal user_r_read_8_open  :  std_logic;
76
  signal user_w_write_8_wren :  std_logic;
77
  signal user_w_write_8_full :  std_logic;
78
  signal user_w_write_8_data :  std_logic_vector(7 DOWNTO 0);
79
  signal user_w_write_8_open :  std_logic;
80
  signal wr_en               :  std_logic := '0';
81
  signal din                 :  std_logic_vector(user_w_write_8_data'range) := (others => '0');
82
  signal char_a              :  integer := 0;
83
  
84
begin
85
  xillybus_ins : xillybus
86
    port map (
87
      -- Ports related to /dev/xillybus_read_8
88
      -- FPGA to CPU signals:
89
      user_r_read_8_rden => user_r_read_8_rden,
90
      user_r_read_8_empty => user_r_read_8_empty,
91
      user_r_read_8_data => user_r_read_8_data,
92
      user_r_read_8_eof => user_r_read_8_eof,
93
      user_r_read_8_open => user_r_read_8_open,
94
95
      -- Ports related to /dev/xillybus_write_8
96
      -- CPU to FPGA signals:
97
      user_w_write_8_wren => user_w_write_8_wren,
98
      user_w_write_8_full => user_w_write_8_full,
99
      user_w_write_8_data => user_w_write_8_data,
100
      user_w_write_8_open => user_w_write_8_open,
101
102
      -- General signals
103
      PCIE_PERST_B_LS => PCIE_PERST_B_LS,
104
      PCIE_REFCLK_N => PCIE_REFCLK_N,
105
      PCIE_REFCLK_P => PCIE_REFCLK_P,
106
      PCIE_RX_N => PCIE_RX_N,
107
      PCIE_RX_P => PCIE_RX_P,
108
      GPIO_LED => GPIO_LED,
109
      PCIE_TX_N => PCIE_TX_N,
110
      PCIE_TX_P => PCIE_TX_P,
111
      bus_clk => bus_clk,
112
      quiesce => quiesce
113
   );
114
115
  process (bus_clk)
116
    
117
  begin 
118
            wr_en <= user_w_write_8_wren;
119
            user_r_read_8_eof <= user_r_read_8_empty and not(user_w_write_8_open);
120
            
121
            if (user_w_write_8_data="01100001") then --a
122
                char_a <= char_a + 1;
123
            end if; 
124
  end process;
125
126
--  8-bit loopback
127
128
  fifo_8 : fifo_8x2048
129
    port map(
130
          clk        => bus_clk,
131
          srst       => reset_8,
132
          din        => din,
133
          wr_en      => wr_en,
134
          rd_en      => user_r_read_8_rden,
135
          dout       => user_r_read_8_data,
136
          full       => user_w_write_8_full,
137
          empty      => user_r_read_8_empty,
138
          char_a     => char_a
139
      );
140
141
    reset_8 <= not (user_w_write_8_open or user_r_read_8_open);
142
    
143
end sample_arch;

I added the signal char_a (integer) that every time user_w_write_8_data 
contains "a" (01100001), char_a increments of 1. The problem is that 
Vivado does not like char_a, because it says:
1
[Netlist 29-77] Could not replace (cell 'fifo_8x2048', library 'work', file 'xillydemo.edf') with (cell 'fifo_8x2048', library 'work', file 'fifo_8x2048.edf') because of a port interface mismatch; 32 ports are missing on the replacing cell. 5 of the missing ports are: 'char_a[31]' 'char_a[30]' 'char_a[29]' 'char_a[1]' 'char_a[0]'.

It seems like I have to define char_a signal somewhere else, but I don't 
know where. Any hint?

Thanks.

von Lothar M. (lkmiller) (Moderator)


Rate this post
0 useful
not useful
Junior H. wrote:
> attribute syn_black_box of fifo_8x2048: component is true;
(How) did you adapt this Xilinx blackbox "fifo_8x2048"?

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [vhdl]VHDL code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.