38 karma · joined Sep 17, 2013 (13y ago) · 31 submissions
comment 7y ago · link · parent
comment 7y ago · link · parent
comment 7y ago · link · parent
input [NUM_OF_MULTIPLIERS*32-1:0] a_in,
input [NUM_OF_MULTIPLIERS*32-1:0] b_in,
output [NUM_OF_MULTIPLIERS*64-1:0] mult_out
reg [31:0] tmp_a, tmp_b;
reg [63:0] tmp_mult;
always @(*) begin
mult_out = {(NUM_OF_MULTIPLIERS*64){1'b0}};
for (i=0; i<NUM_OF_MULTIPLIERS; i+=1) begin
tmp_a = a_in>>(i*32);
tmp_b = b_in>>(i*32);
tmp_mult = tmp_a*tmp_b;
mult_out |= tmp_mult<<(i*64);
end
end
Would give you NUM_OF_MULTIPLIERS multipliers. If you wrote each multiply out, it would be more code and also wouldn't allow you to parametrize the code.comment 7y ago · link · parent
comment 7y ago · link · parent
comment 8y ago · link · parent
comment 9y ago · link · parent
comment 9y ago · link · parent
comment 9y ago · link · parent
You can get Xilinx's component for their pma/pcs for 10g base-r ethernet for free from vivado and stick one of the macs from open cores on the end of it (probably this: http://opencores.org/project,xge_ll_mac - I used it for prototyping and it seems to work (before creating my own pcs/pma block and mac to cut down the latency)
Once you have that, then you would need to deal with the ethernet frames streaming through the FPGA, probably 64-bits at a time at 156MHz for 10G, so you need to pull out the fields you are interested in (like mac addresses, ip addresses, etc). You can buffer the incoming packet into a FIFO whilst waiting for the stuff you want to filter on. Once you have all your fields you can decide whether you want to pass the packet through to the tx side or not (I usually read the packet out of the FIFO either way and just hold the valid low for packets I don't want to send).
Hope this makes sense!
comment 9y ago · link · parent
comment 9y ago · link · parent
comment 10y ago · link · parent
reg [31:0] mem[0:1023];
always @(posedge clk) begin
rd_data <= mem[rd_addr];
if (wr_en)
mem[wr_addr] <= wr_data;
end
Then tools like vivado, quartus, synplify will infer a 1k x 32bits ram.comment 11y ago · link · parent
comment 11y ago · link · parent
comment 11y ago · link · parent
comment 11y ago · link · parent
i_sm: process(clk, reset)
begin
if (reset) then
state <= DATA_BITS;
elsif (clk'event and clk = '1') then
case (state)
when DATA_BITS =>
if (data_valid = '1') then
if (count < 8) then
count <= count + 1;
else
state <= STOP_BIT;
count <= 0;
end if;
end if;
when STOP_BITS =>
if (data_valid = '1') then
if (count < num_stop_bits) then
count <= count + 1;
else
state <= DATA_BITS;
count <= 0;
end if;
end if;
end case
end if;
end process i_sm;
which is not too dis-similar from the Cx example (I've missed a few things out like port/signal declerations, just wanted to show the guts of the code). The thing I like about VHDL/Verilog is that its easy to tell the exact port names, what the clk is, the name and type of reset, etc which is useful information for putting the block in the context of an overall system.comment 12y ago · link · parent
comment 12y ago · link · parent
Very similar to Zynq but from altera rather than xilinx
25.
Mercenne Twister FPGA implementation on GitHub(scottwilson46.github.io ↗)
1 points · by scott_wilson46 · 12y ago · discuss
26.
Random Numbers on FPGA (running monte carlo sims on FPGA)(scottwilson46.github.io ↗)
1 points · by scott_wilson46 · 12y ago · discuss
comment 12y ago · link · parent
INIT:
begin
if (count == 9) begin
next_count == 0;
nextState = `EVALUATE;
end
else
next_count == count + 1;
case (count)
0: begin ram_wr_addr = count; ram_wr_data = `CMD_LED_ON; ram_wr_en = 1; end
1: begin ram_wr_addr = count; ram_wr_data = `CMD_LOAD_NEXT_TO_ACCU; ram_wr_en = 1; end
etc....
end
usually you have a ram module that takes an address and some write_data, wr_en, etc rather than accessing the array directly.comment 13y ago · link · parent
"Many well-known web-sites deploy distributed in- memory caches, which are implemented with standard DRAM on a large array of x86 servers, to reduce access load on databases"
then a single server with an FPGA card on it is going to be a lot cheaper than an array of x86 servers. Plus I would imagine that real-estate in a data centre is another significant cost and having one server with an attached FPGA would also be an advantage in this situation