P
pini
Guest
reg [7:0] TYPEFIL_REG=uno;
You can initialize when targeting to synthesis (only for
verification). Use reset instead.
if(posedge clock or negedge reset_n) begin
if(~reset_n) ....
else ..
Bassman59a@yahoo.com (Andy Peters) wrote in message news:<9a2c3a75.0402061216.7206d4cf@posting.google.com>...
You can initialize when targeting to synthesis (only for
verification). Use reset instead.
if(posedge clock or negedge reset_n) begin
if(~reset_n) ....
else ..
Bassman59a@yahoo.com (Andy Peters) wrote in message news:<9a2c3a75.0402061216.7206d4cf@posting.google.com>...
filippdavid@yahoo.com (filippo) wrote in message news:<18add487.0402060204.340e7b39@posting.google.com>...
I' m having great troubles making a small project on FPGA in Verilog.
I have to do it for an exam at university, it shoul be simple but it's
becoming hell.
problem:
all simulations with modelsim are good, but it just doesn' t work on
the real FPGA and i don't know where to find a solution (or where is
the real problem).
Did you perform both pre- and post-route simulations? What does your
test bench actually do? Is it a real bus-functional model of your
microcontroller? Or are you just setting and clearing signals in some
arbitrary fashion? I would imagine that this is the root of your
problem -- your simulation is bogus. As they say: garbage in, garbage
out?
What about your timing constraints?
of the 10+ modules one seems to be the most troublesome, our
IO_control, here is the code ,please help.
---------------------------------------------------------------------------------
module IO_control(ALE,NWR,NRD,DIR,DA,MIN,MAX,SEL,TYPEFIL,AMPLIF,DIVFRQ,clk);
input ALE;
input NWR;
input clk;
input NRD;
input DIR;
input [7:0] MIN;
input [7:0] MAX;
inout [7:0] DA;
output [7:0] SEL;
output [7:0] TYPEFIL;
output [7:0] AMPLIF;
output [7:0] DIVFRQ;
parameter uno = 8'b0000_0001;
reg [7:0] ADDR_REG;
reg [7:0] DO_REG;
reg [7:0] SEL_REG=uno;
reg [7:0] TYPEFIL_REG=uno;
reg [7:0] AMPLIF_REG=uno;
reg [7:0] DIVFRQ_REG=uno;
^^^^^^^^^^^
This initialization is illegal, or at least ignored by a synthesis
tool.
Use an external reset to actually initialize these registers.
assign SEL = SEL_REG;
assign TYPEFIL = TYPEFIL_REG;
assign AMPLIF = AMPLIF_REG;
assign DIVFRQ = DIVFRQ_REG;
Ummmmm...why not declare the SEL, TYPEFIL, AMPLIF and DIVFRQ outputs
as regs and not bother with this silly assign? Also: explicitly
declare whether your module outputs are wires or regs. It's a good
style habit.
assign DA = (DIR) ? 8'bzzzz_zzzz : DO_REG;
always @ (posedge clk)
begin
if (ALE) ADDR_REG <= DA;
if (~NWR)
case (ADDR_REG)
8'b0000_0001 : SEL_REG <= DA;
8'b0000_0010 : TYPEFIL_REG <= DA;
8'b0000_0100 : AMPLIF_REG <= DA;
8'b0000_1000 : DIVFRQ_REG <=DA;
default DO_REG <= 8'b1111_1111;
endcase
if (~NRD)
case (ADDR_REG)
8'b0000_0001 : DO_REG <= SEL_REG;
8'b0000_0010 : DO_REG <= TYPEFIL_REG;
8'b0000_0100 : DO_REG <= AMPLIF_REG;
8'b0000_1000 : DO_REG <= DIVFRQ_REG;
8'b0001_0000 : DO_REG <= MIN;
8'b0010_0000 : DO_REG <= MAX;
default DO_REG <= 8'b1111_1111;
endcase
end
Umm, another style issue. Use more than one always statement for the
above. You have three separate registers; put 'em in their own always
blocks.
Also: are ALE, NRD, NWR, DA all synchronous to your clock?
Remember that ALE is a latch enable -- are you sure that your address
is actually valid when the latch enable is active and goes away?
--a