[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [ethmac] BFM model for MII_RX i/f



Hi, Kostas,

I thought I saw a little bug on line 136:

 case ch is
                                                when '0'       => data :=
"0000";
                                                when '1'       => data :=
"0001"; 
                                                when '2'       => data :=
"0010";
                                                when '3'       => data :=
"0111";
3 is "0011"

And a less error-prone conversion (I abhor manually edited tables) from hex
char to 4-bit data would be

function hex_to_nybble(ch:character) return unsigned is
variable hexch : natural;
begin
	assert (ch>='0' and ch<='9') or (ch>='A' and ch<='F') or (ch>='a'
and ch<='f') severity failure;
	hexch:=character'pos(ch)-character'pos('0');
	if ch>='A' then
		hexch:=hexch-(character'pos('A')-character'pos('9')-1);
	end if;
	if ch>'F' then
		hexch:=hexch-(character'pos('a')-character'pos('A'));
	end if;
	return to_unsigned(hexch,4);
end hex_to_nybble;

signal x : unsigned(9*4-1 downto 0);

begin

	x<=hex_to_nybble('0')&hex_to_nybble('1')&hex_to_nybble('9')&
		hex_to_nybble('A')&hex_to_nybble('B')&hex_to_nybble('F')&
		hex_to_nybble('a')&hex_to_nybble('b')&hex_to_nybble('f')
--or try for some fun:
hex_to_nybble('g')&hex_to_nybble('G')&hex_to_nybble('!')
	;


-----Original Message-----
From: Kostas Pramataris [mailto:kpram@lucent.com]
Sent: donderdag 30 november 2000 15:22
To: ethmac@opencores.org
Cc: maik@opencores.org
Subject: [ethmac] BFM model for MII_RX i/f


Hi all

I've written a bus functional model for the MII receive i/f. The model
reads packet-data from a file and drives them to the MII RX i/f. The
model could be used for building a testbench for the ethmac_receiver.

Attached is the vhdl file for the model, a required package and a sample
packet-file.

regards,

kostas