w11 - vhd 0.794
W11 CPU core and support modules
Loading...
Searching...
No Matches
rgbdrv_3x4mux.vhd
Go to the documentation of this file.
1-- $Id: rgbdrv_3x4mux.vhd 1181 2019-07-08 17:00:50Z mueller $
2-- SPDX-License-Identifier: GPL-3.0-or-later
3-- Copyright 2016- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4--
5------------------------------------------------------------------------------
6-- Module Name: rgbdrv_3x4mux - syn
7-- Description: rgbled driver: mux three 4bit inputs
8--
9-- Dependencies: xlib/iob_reg_o_gen
10-- Test bench: -
11-- Target Devices: generic
12-- Tool versions: viv 2015.4; ghdl 0.31
13--
14-- Revision History:
15-- Date Rev Version Comment
16-- 2016-02-27 737 1.0 Initial version (re-write, new logic)
17-- 2016-02-20 734 0.1 First draft
18------------------------------------------------------------------------------
19
20library ieee;
21use ieee.std_logic_1164.all;
22use ieee.numeric_std.all;
23
24use work.slvtypes.all;
25use work.xlib.all;
26
27entity rgbdrv_3x4mux is -- rgbled driver: mux three 4bit inputs
28 port (
29 CLK : in slbit; -- clock
30 RESET : in slbit := '0'; -- reset
31 CE_USEC : in slbit; -- 1 us clock enable
32 DATR : in slv4; -- red data
33 DATG : in slv4; -- green data
34 DATB : in slv4; -- blue data
35 O_RGBLED0 : out slv3; -- pad-o: rgb led 0
36 O_RGBLED1 : out slv3; -- pad-o: rgb led 1
37 O_RGBLED2 : out slv3; -- pad-o: rgb led 2
38 O_RGBLED3 : out slv3 -- pad-o: rgb led 3
39 );
41
42
43architecture syn of rgbdrv_3x4mux is
44
45 signal R_LED : slv4 := "0001";
46 signal R_COL : slv3 := "001";
47 signal R_DIM : slbit := '1';
48
49 signal RGB0 : slv3 := (others=>'0');
50 signal RGB1 : slv3 := (others=>'0');
51 signal RGB2 : slv3 := (others=>'0');
52 signal RGB3 : slv3 := (others=>'0');
53
54begin
55
56 IOB_RGB0: iob_reg_o_gen
57 generic map (DWIDTH => 3)
58 port map (CLK => CLK, CE => '1', DO => RGB0, PAD => O_RGBLED0);
59 IOB_RGB1: iob_reg_o_gen
60 generic map (DWIDTH => 3)
61 port map (CLK => CLK, CE => '1', DO => RGB1, PAD => O_RGBLED1);
62 IOB_RGB2: iob_reg_o_gen
63 generic map (DWIDTH => 3)
64 port map (CLK => CLK, CE => '1', DO => RGB2, PAD => O_RGBLED2);
65 IOB_RGB3: iob_reg_o_gen
66 generic map (DWIDTH => 3)
67 port map (CLK => CLK, CE => '1', DO => RGB3, PAD => O_RGBLED3);
68
69 proc_regs: process (CLK)
70 begin
71
72 if rising_edge(CLK) then
73 if RESET = '1' then
74 R_LED <= "0001";
75 R_COL <= "001";
76 R_DIM <= '1';
77 else
78 if CE_USEC = '1' then
79 R_DIM <= not R_DIM;
80 if R_DIM = '1' then
81 R_COL <= R_COL(1) & R_COL(0) & R_COL(2);
82 if R_COL(2) = '1' then
83 R_LED <= R_LED(2) & R_LED(1) & R_LED(0) & R_LED(3);
84 end if;
85 end if;
86 end if;
87 end if;
88 end if;
89
90 end process proc_regs;
91
92 proc_mux: process (R_DIM, R_COL, R_LED, DATR, DATG, DATB)
93 begin
94 RGB0(0) <= (not R_DIM) and R_COL(0) and R_LED(0) and DATR(0);
95 RGB0(1) <= (not R_DIM) and R_COL(1) and R_LED(0) and DATG(0);
96 RGB0(2) <= (not R_DIM) and R_COL(2) and R_LED(0) and DATB(0);
97
98 RGB1(0) <= (not R_DIM) and R_COL(0) and R_LED(1) and DATR(1);
99 RGB1(1) <= (not R_DIM) and R_COL(1) and R_LED(1) and DATG(1);
100 RGB1(2) <= (not R_DIM) and R_COL(2) and R_LED(1) and DATB(1);
101
102 RGB2(0) <= (not R_DIM) and R_COL(0) and R_LED(2) and DATR(2);
103 RGB2(1) <= (not R_DIM) and R_COL(1) and R_LED(2) and DATG(2);
104 RGB2(2) <= (not R_DIM) and R_COL(2) and R_LED(2) and DATB(2);
105
106 RGB3(0) <= (not R_DIM) and R_COL(0) and R_LED(3) and DATR(3);
107 RGB3(1) <= (not R_DIM) and R_COL(1) and R_LED(3) and DATG(3);
108 RGB3(2) <= (not R_DIM) and R_COL(2) and R_LED(3) and DATB(3);
109 end process proc_mux;
110
111end syn;
in CE slbit := '1'
out PAD slv( DWIDTH- 1 downto 0)
in CLK slbit
in DO slv( DWIDTH- 1 downto 0)
DWIDTH positive := 16
slbit := '1' R_DIM
slv3 := "001" R_COL
slv3 :=( others => '0') RGB1
slv3 :=( others => '0') RGB0
slv4 := "0001" R_LED
slv3 :=( others => '0') RGB2
slv3 :=( others => '0') RGB3
in CE_USEC slbit
out O_RGBLED3 slv3
in CLK slbit
out O_RGBLED0 slv3
out O_RGBLED2 slv3
in RESET slbit := '0'
out O_RGBLED1 slv3
std_logic_vector( 3 downto 0) slv4
Definition: slvtypes.vhd:36
std_logic_vector( 2 downto 0) slv3
Definition: slvtypes.vhd:35
std_logic slbit
Definition: slvtypes.vhd:30
Definition: xlib.vhd:35