paralla to serials.v.bak

来自「一个关于热敏打印机时序的仿真程序,能够应用于大多数的热敏打印机中,实现了打印数据」· BAK 代码 · 共 71 行

BAK
71
字号
`timescale 1ns/1nsmodule PtoS(               //output               PR_CLK,               PR_DATA,               //input               CLK,               DATA_CS,               DATA_LATCH,               DATA           );output PR_CLK;output PR_DATA;input  CLK;input  DATA_CS;input  DATA_LATCH;input  [7:0] DATA;//input 8 bit datawire   PR_CLK; //the gate control clkwire   PR_DATA;//the serials data to outputreg    [1:0] flag = 0;reg    [7:0] d; //the memory that store the input datareg    [3:0] count = 0;//note: this will be a problem in synthesisassign PR_CLK  = ((count >= 0) && (count <= 7) && (DATA_CS))? CLK : 1'b0;assign PR_DATA = (DATA_CS)? d[7] : 1'b0;always @(posedge CLK)begin    if(count == 7)    begin        count <= 0;        if(DATA_CS)         begin               if(count < 7)            begin                if(flag == 0)                begin                    count <= 0;                    flag  <= 1;                end                else                    count <= count + 1;            end            if(flag == 1)                flag <= 2;        end    end    endalways @(posedge DATA_LATCH)    d = DATA;always @(posedge PR_CLK)begin    if(count == 0)    begin        if(flag == 1)            d <= {d[6:0],1'b0};        else            d <= d;    end    else if(count <= 7)        d <= {d[6:0],1'b0};endendmodule

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?