OpenCores
URL https://opencores.org/ocsvn/uart2bus/uart2bus/trunk

Subversion Repositories uart2bus

[/] [uart2bus/] [trunk/] [vhdl/] [rtl/] [uartParser.vhd] - Blame information for rev 6

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 6 smuller
-----------------------------------------------------------------------------------------
2
-- uart parser module  
3
--
4
-----------------------------------------------------------------------------------------
5
library IEEE;
6
use IEEE.STD_LOGIC_1164.ALL;
7
use IEEE.STD_LOGIC_UNSIGNED.ALL;
8
 
9
entity uartParser is
10
  generic ( -- parameters 
11
            AW : integer := 8);
12
  port ( -- global signals 
13
         clr        : in  std_logic;                         -- global reset input
14
         clk        : in  std_logic;                         -- global clock input
15
         -- transmit and receive internal interface signals from uart interface
16
         txBusy     : in  std_logic;                         -- signs that transmitter is busy
17
         rxData     : in  std_logic_vector(7 downto 0);      -- data byte received
18
         newRxData  : in  std_logic;                         -- signs that a new byte was received
19
         txData     : out std_logic_vector(7 downto 0);      -- data byte to transmit
20
         newTxData  : out std_logic;                         -- asserted to indicate that there is a new data byte for transmission
21
         -- internal bus to register file 
22
         intRdData  : in  std_logic_vector(7 downto 0);      -- data read from register file
23
         intAddress : out std_logic_vector(AW - 1 downto 0); -- address bus to register file
24
         intWrData  : out std_logic_vector(7 downto 0);      -- write data to register file
25
         intWrite   : out std_logic;                         -- write control to register file
26
         intRead    : out std_logic);                        -- read control to register file
27
end uartParser;
28
 
29
architecture Behavioral of uartParser is
30
 
31
  -- internal constants 
32
  -- main (receive) state machine states
33
  signal   mainSm         : std_logic_vector(3 downto 0); -- main state machine
34
  constant mainIdle       : std_logic_vector(mainSm'range) := "0000";
35
  constant mainWhite1     : std_logic_vector(mainSm'range) := "0001";
36
  constant mainData       : std_logic_vector(mainSm'range) := "0010";
37
  constant mainWhite2     : std_logic_vector(mainSm'range) := "0011";
38
  constant mainAddr       : std_logic_vector(mainSm'range) := "0100";
39
  constant mainEol        : std_logic_vector(mainSm'range) := "0101";
40
  -- binary mode extension states
41
  constant mainBinCmd     : std_logic_vector(mainSm'range) := "1000";
42
  constant mainBinAdrh    : std_logic_vector(mainSm'range) := "1001";
43
  constant mainBinAdrl    : std_logic_vector(mainSm'range) := "1010";
44
  constant mainBinLen     : std_logic_vector(mainSm'range) := "1011";
45
  constant mainBinData    : std_logic_vector(mainSm'range) := "1100";
46
 
47
  -- transmit state machine
48
  signal   txSm           : std_logic_vector(2 downto 0); -- transmit state machine
49
  constant txIdle         : std_logic_vector(txSm'range) := "000";
50
  constant txHiNib        : std_logic_vector(txSm'range) := "001";
51
  constant txLoNib        : std_logic_vector(txSm'range) := "100";
52
  constant txCharCR       : std_logic_vector(txSm'range) := "101";
53
  constant txCharLF       : std_logic_vector(txSm'range) := "110";
54
 
55
  -- define characters used by the parser
56
  constant charNul        : std_logic_vector(7 downto 0) := x"00";
57
  constant charTab        : std_logic_vector(7 downto 0) := x"09";
58
  constant charLF         : std_logic_vector(7 downto 0) := x"0A";
59
  constant charCR         : std_logic_vector(7 downto 0) := x"0D";
60
  constant charSpace      : std_logic_vector(7 downto 0) := x"20";
61
  constant charZero       : std_logic_vector(7 downto 0) := x"30";
62
  constant charOne        : std_logic_vector(7 downto 0) := x"31";
63
  constant charTwo        : std_logic_vector(7 downto 0) := x"32";
64
  constant charThree      : std_logic_vector(7 downto 0) := x"33";
65
  constant charFour       : std_logic_vector(7 downto 0) := x"34";
66
  constant charFive       : std_logic_vector(7 downto 0) := x"35";
67
  constant charSix        : std_logic_vector(7 downto 0) := x"36";
68
  constant charSeven      : std_logic_vector(7 downto 0) := x"37";
69
  constant charEight      : std_logic_vector(7 downto 0) := x"38";
70
  constant charNine       : std_logic_vector(7 downto 0) := x"39";
71
  constant charAHigh      : std_logic_vector(7 downto 0) := x"41";
72
  constant charBHigh      : std_logic_vector(7 downto 0) := x"42";
73
  constant charCHigh      : std_logic_vector(7 downto 0) := x"43";
74
  constant charDHigh      : std_logic_vector(7 downto 0) := x"44";
75
  constant charEHigh      : std_logic_vector(7 downto 0) := x"45";
76
  constant charFHigh      : std_logic_vector(7 downto 0) := x"46";
77
  constant charRHigh      : std_logic_vector(7 downto 0) := x"52";
78
  constant charWHigh      : std_logic_vector(7 downto 0) := x"57";
79
  constant charALow       : std_logic_vector(7 downto 0) := x"61";
80
  constant charBLow       : std_logic_vector(7 downto 0) := x"62";
81
  constant charCLow       : std_logic_vector(7 downto 0) := x"63";
82
  constant charDLow       : std_logic_vector(7 downto 0) := x"64";
83
  constant charELow       : std_logic_vector(7 downto 0) := x"65";
84
  constant charFLow       : std_logic_vector(7 downto 0) := x"66";
85
  constant charRLow       : std_logic_vector(7 downto 0) := x"72";
86
  constant charWLow       : std_logic_vector(7 downto 0) := x"77";
87
 
88
  -- binary extension mode commands - the command is indicated by bits 5:4 of the command byte
89
  constant binCmdNop      : std_logic_vector(1 downto 0) := "00";
90
  constant binCmdRead     : std_logic_vector(1 downto 0) := "01";
91
  constant binCmdWrite    : std_logic_vector(1 downto 0) := "10";
92
 
93
  signal   dataInHexRange : std_logic;                          -- indicates that the received data is in the range of hex number
94
  signal   binLastByte    : std_logic;                          -- last byte flag indicates that the current byte in the command is the last
95
  signal   txEndP         : std_logic;                          -- transmission end pulse
96
  signal   readOp         : std_logic;                          -- read operation flag
97
  signal   writeOp        : std_logic;                          -- write operation flag
98
  signal   binReadOp      : std_logic;                          -- binary mode read operation flag
99
  signal   binWriteOp     : std_logic;                          -- binary mode write operation flag
100
  signal   sendStatFlag   : std_logic;                          -- send status flag
101
  signal   addrAutoInc    : std_logic;                          -- address auto increment mode
102
  signal   dataParam      : std_logic_vector(7 downto 0);       -- operation data parameter
103
  signal   dataNibble     : std_logic_vector(3 downto 0);       -- data nibble from received character
104
  signal   addrParam      : std_logic_vector(15 downto 0);      -- operation address parameter
105
  signal   addrNibble     : std_logic_vector(3 downto 0);       -- data nibble from received character
106
  signal   binByteCount   : std_logic_vector(7 downto 0);       -- binary mode byte counter
107
  signal   iIntAddress    : std_logic_vector(intAddress'range); -- 
108
  signal   iIntWrite      : std_logic;                          -- 
109
  signal   readDone       : std_logic;                          -- internally generated read done flag
110
  signal   readDoneS      : std_logic;                          -- sampled read done
111
  signal   readDataS      : std_logic_vector(7 downto 0);       -- sampled read data
112
  signal   iIntRead       : std_logic;                          -- 
113
  signal   txChar         : std_logic_vector(7 downto 0);       -- transmit byte from nibble to character conversion
114
  signal   sTxBusy        : std_logic;                          -- sampled tx_busy for falling edge detection
115
  signal   txNibble       : std_logic_vector(3 downto 0);       -- nibble value for transmission
116
 
117
  -- module implementation
118
  -- main state machine
119
  begin
120
    process (clr, clk)
121
    begin
122
      if (clr = '1') then
123
        mainSm <= mainIdle;
124
      elsif (rising_edge(clk)) then
125
        if (newRxData = '1') then
126
          case mainSm is
127
            -- wait for a read ('r') or write ('w') command
128
            -- binary extension - an all zeros byte enabled binary commands 
129
            when mainIdle =>
130
              -- check received character
131
              if (rxData = charNul) then
132
                -- an all zeros received byte enters binary mode
133
                mainSm <= mainBinCmd;
134
              elsif ((rxData = charRLow) or (rxData = charRHigh)) then
135
                -- on read wait to receive only address field
136
                mainSm <= mainWhite2;
137
              elsif ((rxData = charWLow) or (rxData = charWHigh)) then
138
                -- on write wait to receive data and address
139
                mainSm <= mainWhite1;
140
              elsif ((rxData = charCR) or (rxData = charLF)) then
141
                -- on new line sta in idle
142
                mainSm <= mainIdle;
143
              else
144
                -- any other character wait to end of line (EOL)
145
                mainSm <= mainEol;
146
              end if;
147
            -- wait for white spaces till first data nibble 
148
            when mainWhite1 =>
149
              -- wait in this case until any white space character is received. in any
150
              -- valid character for data value switch to data state. a new line or carriage
151
              -- return should reset the state machine to idle.
152
              -- any other character transitions the state machine to wait for EOL.
153
              if ((rxData = charSpace) or (rxData = charTab)) then
154
                mainSm <= mainWhite1;
155
              elsif (dataInHexRange = '1') then
156
                mainSm <= mainData;
157
              elsif ((rxData = charCR) or (rxData = charLF)) then
158
                mainSm <= mainIdle;
159
              else
160
                mainSm <= mainEol;
161
              end if;
162
            -- receive data field
163
            when mainData =>
164
              -- wait while data in hex range. white space transition to wait white 2 state.
165
              -- CR and LF resets the state machine. any other value cause state machine to
166
              -- wait til end of line.
167
              if (dataInHexRange = '1') then
168
                mainSm <= mainData;
169
              elsif ((rxData = charSpace) or (rxData = charTab)) then
170
                mainSm <= mainWhite2;
171
              elsif ((rxData = charCR) or (rxData = charLF)) then
172
                mainSm <= mainIdle;
173
              else
174
                mainSm <= mainEol;
175
              end if;
176
            -- wait for white spaces till first address nibble
177
            when mainWhite2 =>
178
              -- similar to MAIN_WHITE1
179
              if ((rxData = charSpace) or (rxData = charTab)) then
180
                mainSm <= mainWhite2;
181
              elsif (dataInHexRange = '1') then
182
                mainSm <= mainAddr;
183
              elsif ((rxData = charCR) or (rxData = charLF)) then
184
                mainSm <= mainIdle;
185
              else
186
                mainSm <= mainEol;
187
              end if;
188
            -- receive address field
189
            when mainAddr =>
190
              -- similar to MAIN_DATA
191
              if (dataInHexRange = '1') then
192
                mainSm <= mainAddr;
193
              elsif ((rxData = charCR) or (rxData = charLF)) then
194
                mainSm <= mainIdle;
195
              else
196
                mainSm <= mainEol;
197
              end if;
198
            -- wait to EOL
199
            when mainEol =>
200
              -- wait for CR or LF to move back to idle
201
              if ((rxData = charCR) or (rxData = charLF)) then
202
                mainSm <= mainIdle;
203
              end if;
204
            -- binary extension
205
            -- wait for command - one byte
206
            when mainBinCmd =>
207
              -- check if command is a NOP command
208
              if (rxData(5 downto 4) = binCmdNop) then
209
                -- if NOP command then switch back to idle state
210
                mainSm <= mainIdle;
211
              else
212
                -- not a NOP command, continue receiving parameters
213
                mainSm <= mainBinAdrh;
214
              end if;
215
            -- wait for address parameter - two bytes
216
            -- high address byte
217
            when mainBinAdrh =>
218
              -- switch to next state
219
              mainSm <= mainBinAdrl;
220
            -- low address byte
221
            when mainBinAdrl =>
222
              -- switch to next state
223
              mainSm <= mainBinLen;
224
            -- wait for length parameter - one byte
225
            when mainBinLen =>
226
              -- check if write command else command reception ended
227
              if (binWriteOp = '1') then
228
                -- wait for write data
229
                mainSm <= mainBinData;
230
              else
231
                -- command reception has ended
232
                mainSm <= mainIdle;
233
              end if;
234
            -- on write commands wait for data till end of buffer as specified by length parameter
235
            when mainBinData =>
236
              -- if this is the last data byte then return to idle
237
              if (binLastByte = '1') then
238
                mainSm <= mainIdle;
239
              end if;
240
            -- go to idle
241
            when others =>
242
              mainSm <= mainIdle;
243
          end case;
244
        end if;
245
      end if;
246
    end process;
247
    -- read operation flag
248
    -- write operation flag
249
    -- binary mode read operation flag
250
    -- binary mode write operation flag
251
    process (clr, clk)
252
    begin
253
      if (clr = '1') then
254
        readOp <= '0';
255
        writeOp <= '0';
256
        binReadOp <= '0';
257
        binWriteOp <= '0';
258
      elsif (rising_edge(clk)) then
259
        if ((mainSm = mainIdle) and (newRxData = '1')) then
260
          -- the read operation flag is set when a read command is received in idle state and cleared
261
          -- if any other character is received during that state.
262
          if ((rxData = charRLow) or (rxData = charRHigh)) then
263
            readOp <= '1';
264
          else
265
            readOp <= '0';
266
          end if;
267
          -- the write operation flag is set when a write command is received in idle state and cleared 
268
          -- if any other character is received during that state.
269
          if ((rxData = charWLow) or (rxData = charWHigh)) then
270
            writeOp <= '1';
271
          else
272
            writeOp <= '0';
273
          end if;
274
        end if;
275
        if ((mainSm = mainBinCmd) and (newRxData = '1') and (rxData(5 downto 4) = binCmdRead)) then
276
          -- read command is started on reception of a read command
277
          binReadOp <= '1';
278
        elsif ((binReadOp = '1') and (txEndP = '1') and (binLastByte = '1')) then
279
          -- read command ends on transmission of the last byte read
280
          binReadOp <= '0';
281
        end if;
282
        if ((mainSm = mainBinCmd) and (newRxData = '1') and (rxData(5 downto 4) = binCmdWrite)) then
283
          -- write command is started on reception of a write command
284
          binWriteOp <= '1';
285
        elsif ((mainSm = mainBinData) and (newRxData = '1') and (binLastByte = '1')) then
286
          binWriteOp <= '0';
287
        end if;
288
      end if;
289
    end process;
290
    -- send status flag - used only in binary extension mode
291
    -- address auto increment - used only in binary extension mode
292
    process (clr, clk)
293
    begin
294
      if (clr = '1') then
295
        sendStatFlag <= '0';
296
        addrAutoInc <= '0';
297
      elsif (rising_edge(clk)) then
298
        if ((mainSm = mainBinCmd) and (newRxData = '1')) then
299
          -- check if a status byte should be sent at the end of the command
300
          sendStatFlag <= rxData(0);
301
          -- check if address should be automatically incremented or not.
302
          -- Note that when rx_data[1] is set, address auto increment is disabled.
303
          addrAutoInc <= not(rxData(1));
304
        end if;
305
      end if;
306
    end process;
307
    -- operation data parameter
308
    process (clr, clk)
309
    begin
310
      if (clr = '1') then
311
        dataParam <= (others => '0');
312
      elsif (rising_edge(clk)) then
313
        if ((mainSm = mainWhite1) and (newRxData = '1') and (dataInHexRange = '1')) then
314
          dataParam <= "0000" & dataNibble;
315
        elsif ((mainSm = mainData) and (newRxData = '1') and (dataInHexRange = '1')) then
316
          dataParam <= dataParam(3 downto 0) & dataNibble;
317
        end if;
318
      end if;
319
    end process;
320
    -- operation address parameter
321
    process (clr, clk)
322
    begin
323
      if (clr = '1') then
324
        addrParam <= (others => '0');
325
      elsif (rising_edge(clk)) then
326
        if ((mainSm = mainWhite2) and (newRxData = '1') and (dataInHexRange = '1')) then
327
          addrParam <= x"000" & dataNibble;
328
        elsif ((mainSm = mainAddr) and (newRxData = '1') and (dataInHexRange = '1')) then
329
          addrParam <= addrParam(11 downto 0) & dataNibble;
330
        -- binary extension
331
        elsif (mainSm = mainBinAdrh) then
332
          addrParam(15 downto 8) <= rxData;
333
        elsif (mainSm = mainBinAdrl) then
334
          addrParam(7 downto 0) <= rxData;
335
        end if;
336
      end if;
337
    end process;
338
    -- binary mode command byte counter is loaded with the length parameter and counts down to zero.
339
    -- NOTE: a value of zero for the length parameter indicates a command of 256 bytes.
340
    process (clr, clk)
341
    begin
342
      if (clr = '1') then
343
        binByteCount <= (others => '0');
344
      elsif (rising_edge(clk)) then
345
        if ((mainSm = mainBinLen) and (newRxData = '1')) then
346
          binByteCount <= rxData;
347
        elsif (((mainSm = mainBinData) and (binWriteOp = '1') and (newRxData = '1')) or ((binReadOp = '1') and (txEndP = '1'))) then
348
          -- byte counter is updated on every new data received in write operations and for every 
349
          -- byte transmitted for read operations.
350
          binByteCount <= binByteCount - 1;
351
        end if;
352
      end if;
353
    end process;
354
    -- internal write control and data
355
    -- internal read control
356
    process (clr, clk)
357
    begin
358
      if (clr = '1') then
359
        iIntRead <= '0';
360
        iIntWrite <= '0';
361
        intWrData <= (others => '0');
362
      elsif (rising_edge(clk)) then
363
        if ((mainSm = mainAddr) and (writeOp = '1') and (newRxData = '1') and (dataInHexRange = '0')) then
364
          iIntWrite <= '1';
365
          intWrData <= dataParam;
366
        -- binary extension mode
367
        elsif ((mainSm = mainBinData) and (binWriteOp = '1') and (newRxData = '1')) then
368
          iIntWrite <= '1';
369
          intWrData <= rxData;
370
        else
371
          iIntWrite <= '0';
372
        end if;
373
        if ((mainSm = mainAddr) and (readOp = '1') and (newRxData = '1') and (dataInHexRange = '0')) then
374
          iIntRead <= '1';
375
        -- binary extension
376
        elsif ((mainSm = mainBinLen) and (binReadOp = '1') and (newRxData = '1')) then
377
          -- the first read request is issued on reception of the length byte
378
          iIntRead <= '1';
379
        elsif ((binReadOp = '1') and (txEndP = '1') and (binLastByte = '0')) then
380
          -- the next read requests are issued after the previous read value was transmitted and
381
          -- this is not the last byte to be read.
382
          iIntRead <= '1';
383
        else
384
          iIntRead <= '0';
385
        end if;
386
      end if;
387
    end process;
388
    -- internal address
389
    process (clr, clk)
390
    begin
391
      if (clr = '1') then
392
        iIntAddress <= (others => '0');
393
      elsif (rising_edge(clk)) then
394
        if ((mainSm = mainAddr) and (newRxData = '1') and (dataInHexRange = '0')) then
395
          iIntAddress <= addrParam(AW - 1 downto 0);
396
        -- binary extension
397
        elsif ((mainSm = mainBinLen) and (newRxData = '1')) then
398
          -- sample address parameter on reception of length byte
399
          iIntAddress <= addrParam(AW - 1 downto 0);
400
        elsif ((addrAutoInc = '1') and (((binReadOp = '1') and (txEndP = '1') and (binLastByte = '0')) or ((binWriteOp = '1') and (iIntWrite = '1')))) then
401
          -- address is incremented on every read or write if enabled
402
          iIntAddress <= iIntAddress + 1;
403
        end if;
404
      end if;
405
    end process;
406
    -- read done flag and sampled data read
407
    process (clr, clk)
408
    begin
409
      if (clr = '1') then
410
        readDone <= '0';
411
        readDoneS <= '0';
412
        readDataS <= (others => '0');
413
      elsif (rising_edge(clk)) then
414
        -- read done flag
415
        readDone <= iIntRead;
416
        -- sampled read done
417
        readDoneS <= readDone;
418
        -- sampled data read
419
        if (readDone = '1') then
420
          readDataS <= intRdData;
421
        end if;
422
      end if;
423
    end process;
424
    -- transmit state machine and control
425
    process (clr, clk)
426
    begin
427
      if (clr = '1') then
428
        txSm <= txIdle;
429
        txData <= (others => '0');
430
        newTxData <= '0';
431
      elsif (rising_edge(clk)) then
432
        case txSm is
433
          -- wait for read done indication
434
          when txIdle =>
435
            -- on end of every read operation check how the data read should be transmitted
436
            -- according to read type: ascii or binary.
437
            if (readDoneS = '1') then
438
              -- on binary mode read transmit byte value
439
              if (binReadOp = '1') then
440
                -- note that there is no need to change state
441
                txData <= readDataS;
442
                newTxData <= '1';
443
              else
444
                txSm <= txHiNib;
445
                txData <= txChar;
446
                newTxData <= '1';
447
              end if;
448
            -- check if status byte should be transmitted
449
            elsif (((sendStatFlag = '1') and (binReadOp = '1') and (txEndP = '1') and (binLastByte = '1')) or ((sendStatFlag = '1') and (binWriteOp = '1') and (newRxData = '1') and (binLastByte = '1')) or ((mainSm = mainBinCmd) and (newRxData = '1') and (rxData(5 downto 4) = binCmdNop))) then
450
              -- send status byte - currently a constant
451
              txData <= x"5A";
452
              newTxData <= '1';
453
            else
454
              newTxData <= '0';
455
            end if;
456
          when txHiNib =>
457
            -- wait for transmit to end
458
            if (txEndP = '1') then
459
              txSm <= txLoNib;
460
              txData <= txChar;
461
              newTxData <= '1';
462
            else
463
              newTxData <= '0';
464
            end if;
465
          -- wait for transmit to end
466
          when txLoNib =>
467
            if (txEndP = '1') then
468
              txSm <= txCharCR;
469
              txData <= charCR;
470
              newTxData <= '1';
471
            else
472
              newTxData <= '0';
473
            end if;
474
          -- wait for transmit to end
475
          when txCharCR =>
476
            if (txEndP = '1') then
477
              txSm <= txCharLF;
478
              txData <= charLF;
479
              newTxData <= '1';
480
            else
481
              newTxData <= '0';
482
            end if;
483
          -- wait for transmit to end
484
          when txCharLF =>
485
            if (txEndP = '1') then
486
              txSm <= txIdle;
487
            end if;
488
            -- clear tx new data flag
489
            newTxData <= '0';
490
          -- return to idle
491
          when others =>
492
            txSm <= txIdle;
493
        end case;
494
      end if;
495
    end process;
496
    -- sampled tx_busy
497
    process (clr, clk)
498
    begin
499
      if (clr = '1') then
500
        sTxBusy <= '1';
501
      elsif (rising_edge(clk)) then
502
        sTxBusy <= txBusy;
503
      end if;
504
    end process;
505
    -- indicates that the received data is in the range of hex number
506
    dataInHexRange <= '1' when (((rxData >= charZero) and (rxData <= charNine)) or
507
                               ((rxData >= charAHigh) and (rxData <= charFHigh)) or
508
                               ((rxData >= charALow) and (rxData <= charFLow))) else '0';
509
    -- last byte in command flag
510
    binLastByte <= '1' when (binByteCount = x"01") else '0';
511
    -- select the nibble to the nibble to character conversion
512
    txNibble <= readDataS(3 downto 0) when (txSm = txHiNib) else readDataS(7 downto 4);
513
    -- tx end pulse
514
    txEndP <= '1' when ((txBusy = '0') and (sTxBusy = '1')) else '0';
515
    -- character to nibble conversion
516
    with rxData select
517
      dataNibble <= x"0" when charZero,
518
                    x"1" when charOne,
519
                    x"2" when charTwo,
520
                    x"3" when charThree,
521
                    x"4" when charFour,
522
                    x"5" when charFive,
523
                    x"6" when charSix,
524
                    x"7" when charSeven,
525
                    x"8" when charEight,
526
                    x"9" when charNine,
527
                    x"A" when charALow,
528
                    x"A" when charAHigh,
529
                    x"B" when charBLow,
530
                    x"B" when charBHigh,
531
                    x"C" when charCLow,
532
                    x"C" when charCHigh,
533
                    x"D" when charDLow,
534
                    x"D" when charDHigh,
535
                    x"E" when charELow,
536
                    x"E" when charEHigh,
537
                    x"F" when charFLow,
538
                    x"F" when charFHigh,
539
                    x"F" when others;
540
    -- nibble to character conversion
541
    with txNibble select
542
      txChar <= charZero when x"0",
543
                charOne when x"1",
544
                charTwo when x"2",
545
                charThree when x"3",
546
                charFour when x"4",
547
                charFive when x"5",
548
                charSix when x"6",
549
                charSeven when x"7",
550
                charEight when x"8",
551
                charNine when x"9",
552
                charAHigh when x"A",
553
                charBHigh when x"B",
554
                charCHigh when x"C",
555
                charDHigh when x"D",
556
                charEHigh when x"E",
557
                charFHigh when x"F",
558
                charFHigh when others;
559
    intAddress <= iIntAddress;
560
    intWrite <= iIntWrite;
561
    intRead <= iIntRead;
562
  end Behavioral;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.